You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Examples found in documentation must be tested to be sure we have the appropriate
6
+
coverage and be sure new releases are tested against regressions.
7
+
8
+
Also, it helps testing any changes in public Identity Providers.
9
+
10
+
Currently few tests are covered, and ``selenium`` package is used to interact with browser. Feel free to have a look at the base class in ``tests/examples/base.py`` to reuse utility specially crafted for testing samples in documentation.
11
+
12
+
Identity Providers available for tests
13
+
======================================
14
+
15
+
Currently only an Auth0 test provider is available but new can be created on request. Following are the environment variables :
16
+
17
+
- Auth0 https://auth0.com/ :
18
+
19
+
- ``AUTH0_USERNAME``
20
+
- ``AUTH0_PASSWORD``
21
+
- ``AUTH0_DOMAIN``
22
+
- ``AUTH0_PKCE_CLIENT_ID``
23
+
24
+
Guidelines to write samples
25
+
===========================
26
+
27
+
Documentation
28
+
^^^^^^^^^^^^^
29
+
30
+
In order to write a testable sample, like an easy copy/paste, it is recommended to separate the python code from the documentation as below :
31
+
32
+
.. code-block::
33
+
34
+
.. literalinclude:: xyz_foobar.py
35
+
:language: python
36
+
37
+
Verify if formatting is correct by checking :
38
+
39
+
.. code-block:: bash
40
+
41
+
tox -e docs
42
+
# output located in docs/_build/html/index.html
43
+
44
+
45
+
Python example
46
+
^^^^^^^^^^^^^^
47
+
48
+
It's recommended to write a python example with either predefined placeholder variables for environment setup properties (like identity provider tenants identifiers/secrets), and use ``input()`` when user interaction is required. Feel free to reuse an existing example like ``docs/examples/native_spa_pkce_auth0.py`` and its associated test.
49
+
50
+
Python tests
51
+
^^^^^^^^^^^^
52
+
53
+
You can write new tests in ``tests/examples/test_*py`` and inherit of base classes found in ``tests/examples/base.py`` based on your needs.
54
+
55
+
Don't forget to skip python tests if you require an environment variables, also don't store any secrets or leak tenant informations in git.
self.skipTest("native auth0 is not configured properly")
66
+
67
+
68
+
Then the sample can be copy paste into a python console
69
+
70
+
Environment variables
71
+
^^^^^^^^^^^^^^^^^^^^^
72
+
73
+
Once referencing environment variables, you have to set them in the Github Actions. Any maintainers can do it, and it's the role of the maintainer to create a test tenant with test clients.
74
+
75
+
Example on how to set new env secrets with `GitHub CLI <https://cli.github.com/>`_:
0 commit comments