|
| 1 | +Tutorial |
| 2 | +-------- |
| 3 | + |
| 4 | +Basic CLI |
| 5 | +========= |
| 6 | + |
| 7 | +scim2-tester provides a very basic command line: |
| 8 | + |
| 9 | +.. code-block:: console |
| 10 | +
|
| 11 | + python scim2_tester/checker.py https://scim.example |
| 12 | +
|
| 13 | +However, we encourage you to use the more complete integration in :doc:`scim2-cli <scim2_cli:index>`: |
| 14 | + |
| 15 | +.. code-block:: console |
| 16 | +
|
| 17 | + pip install scim2-cli |
| 18 | + scim https://scim.example test |
| 19 | +
|
| 20 | +You can check the :ref:`scim2-cli test command reference <scim2_cli:test>` for more details. |
| 21 | + |
| 22 | +Unit test suite integration |
| 23 | +=========================== |
| 24 | + |
| 25 | +If you build a Python SCIM sever application and need a complete test suite to check you implementation, you can integrate `scim2-tester` in your test suite with little effort. |
| 26 | +Thanks to scim2-client :class:`~scim2_client.engines.werkzeug.TestSCIMClient` engine, no real HTTP request is made, but the server code is directly executed. |
| 27 | +This allows you to catch server exceptions in the test contexts, which is very handy for development. |
| 28 | + |
| 29 | +As :class:`~scim2_client.engines.werkzeug.TestSCIMClient` relies on :doc:`Werkzeug <werkzeug:index>`, you need to check that you have installed the right dependencies to use it: |
| 30 | + |
| 31 | +.. code-block:: console |
| 32 | +
|
| 33 | + uv add --group dev scim2-models[werkzeug] |
| 34 | +
|
| 35 | +.. code-block:: python |
| 36 | +
|
| 37 | + from scim2_models import User, Group |
| 38 | + from scim2_client.engines.werkzeug import TestSCIMClient |
| 39 | + from scim2_tester import check_server, Status |
| 40 | + from myapp import create_app |
| 41 | +
|
| 42 | + def test_scim_tester(): |
| 43 | + app = create_app(...) |
| 44 | + client = TestSCIMClient(app=app, scim_prefix="/scim/v2", resource_models=(User, Group)) |
| 45 | + results = check_server(client) |
| 46 | + for result in results: |
| 47 | + assert result.status == Status.SUCCESS |
0 commit comments