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
Release history Release notifications | RSS feed
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)
Built Distribution
Close
Hashes for idnow_responses-0.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d637e96b66ecd3efb5a5c4a8623267a9f2d9e1fb050249a72acff2504860e15f |
|
MD5 | 6cef4d6b3868de29be81f57e75654f3a |
|
BLAKE2b-256 | 37b74cede0e090d7c61e9d35e92a88d83689dcb0011466e7bd9e7f3d0fbfe200 |