@@ -4,13 +4,7 @@ Tutorial
44Basic CLI
55=========
66
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 >`:
7+ scim2-tester is integrated in :doc: `scim2-cli <scim2_cli:index >`:
148
159.. code-block :: console
1610
@@ -19,6 +13,28 @@ However, we encourage you to use the more complete integration in :doc:`scim2-cl
1913
2014 You can check the :ref: `scim2-cli test command reference <scim2_cli:test >` for more details.
2115
16+ Code integration
17+ ================
18+
19+ If you need to integrate the tester in your code, you can initialize a :ref: `scim2-client engine <scim2_client:engines >`
20+ and pass it to the :meth: `~scim2_tester.check_server ` method:
21+
22+ .. code-block :: python
23+
24+ from httpx import Client
25+ from scim2_client.engines.httpx import SyncSCIMClient
26+ from scim2_tester import check_server
27+
28+ httpx_client = Client(
29+ base_url = " https://auth.example/scim/v2" ,
30+ headers = {" Authorization" : " Bearer foobar" },
31+ )
32+ scim_client = SyncSCIMClient(httpx_client)
33+ results = check_server(scim_client)
34+ for result in results:
35+ print (result.status.name, result.title)
36+
37+
2238 Unit test suite integration
2339===========================
2440
@@ -34,13 +50,13 @@ As :class:`~scim2_client.engines.werkzeug.TestSCIMClient` relies on :doc:`Werkze
3450
3551 .. code-block :: python
3652
37- from scim2_models import User, Group
3853 from scim2_client.engines.werkzeug import TestSCIMClient
39- from scim2_tester import check_server, Status
54+ from scim2_tester import check_server
4055 from werkzeug.test import Client
4156 from myapp import create_app
4257
4358 def test_scim_tester ():
4459 app = create_app(... )
45- client = TestSCIMClient(app = Clien(app), scim_prefix = " /scim/v2" )
60+ testclient = Client(app)
61+ client = TestSCIMClient(app = testclient, scim_prefix = " /scim/v2" )
4662 check_server(client, raise_exceptions = True )
0 commit comments