Skip to main content

A third-party pytest plugin that provides a fixture to mock the IdNow identification service

Project description

idnow_responses

A third-party pytest plugin that provides a fixture to mock the IdNow identification service.

Installation

pip install idnow-responses

Usage

This plugin makes the idnow_responses fixture available. Typically the request to IdNow would be within the tested code and not within the test. For simplicity, it's here in the request:

import requests
import idnow_responses

idnow_responses.company_id = "Mandala"


def test_service(idnow_responses):
    company_id = "Mandala"

    # Create ident
    url = f"https://gateway.test.idnow.de/api/v1/{company_id}/identifications/foo-123-ab/start"
    response = requests.post(url)
    assert response.status_code == 200
    assert response.json() == {"id": "foo-123-ab"}

    # Get ident
    url = (
        f"https://gateway.test.idnow.de/api/v1/{company_id}/identifications/foo-123-ab"
    )
    response = requests.get(url)
    assert response.status_code == 200
    assert response.json() == {"id": "foo-123-ab"}

    # Get unknown ident
    url = f"https://gateway.test.idnow.de/api/v1/{company_id}/identifications/unknown-tx-id"
    response = requests.get(url)
    assert response.status_code == 404
    assert response.json() == {"errors": [{"cause": "OBJECT_NOT_FOUND"}]}

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

idnow_responses-0.0.2.tar.gz (3.5 kB view hashes)

Uploaded Source

Built Distribution

idnow_responses-0.0.2-py3-none-any.whl (3.9 kB view hashes)

Uploaded Python 3

Supported by

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