Skip to main content

SCIM2 server fixture for Pytest

Project description

pytest-scim2-server

SCIM2 server fixture for Pytest

Installation

pip install pytest-scim2-server

Usage

pytest-scim2-server creates a scim2_server fixture that runs an instance of scim2-server on a random port, in a dedicated thread.

import requests

def test_scim_foobar(scim2_server):
    host, port = scim2_server

    res = request.get(f"http://{host}:{port}")
    ...

Note that you can use scim2-client to interact with the SCIM server.

import pytest
from httpx import Client
from scim2_client.engines.httpx import SyncSCIMClient


@pytest.fixture(scope="session")
def scim_client(scim2_server):
    host, port = scim2_server
    http_client = Client(base_url=f"http://{host}:{port}")
    scim_client = SyncSCIMClient(http_client)
    scim_client.discover()
    return scim_client


def test_scim2_server(scim_client):
    User = scim_client.get_resource_model("User")
    user = User(user_name="bjensen@example.com")
    response = scim_client.create(user)

    users = scim_client.query(User)
    assert users.resources[0].id == response.id

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pytest_scim2_server-0.1.0.tar.gz (39.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pytest_scim2_server-0.1.0-py3-none-any.whl (3.1 kB view details)

Uploaded Python 3

File details

Details for the file pytest_scim2_server-0.1.0.tar.gz.

File metadata

  • Download URL: pytest_scim2_server-0.1.0.tar.gz
  • Upload date:
  • Size: 39.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.5.24

File hashes

Hashes for pytest_scim2_server-0.1.0.tar.gz
Algorithm Hash digest
SHA256 64cc16bd87aabd44b096130a4df71c794eead1892b19a8d466f8c6df0f6b3c7a
MD5 9adf1157651f52c9d992172653b89a71
BLAKE2b-256 73c20ec111665f0faabdab5b9027f6498850eed301a0047cfae183c722a77573

See more details on using hashes here.

File details

Details for the file pytest_scim2_server-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for pytest_scim2_server-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 08443d8bd677a20731a587bb93bc90f31582ca9c1da3642edec5ee49dbf34b32
MD5 e9de3659531448f7bcd8ab3f62c90438
BLAKE2b-256 c8e0a0c3de43d4e03c227deb7daadc4f230ea1140d44e038e3f76272526bd0d8

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page