Metadata-Version: 2.1
Name: idnow_responses
Version: 0.0.2
Summary: A third-party pytest plugin that provides a fixture to mock the IdNow identification service
Home-page: https://github.com/MartinThoma/responses-idnow
Author: Martin Thoma
Author-email: info@martin-thoma.de
Maintainer: Martin Thoma
Maintainer-email: info@martin-thoma.de
License: Unlicense
Platform: UNKNOWN
Classifier: Development Status :: 4 - Beta
Classifier: Framework :: Pytest
Classifier: Intended Audience :: Developers
Classifier: Topic :: Software Development :: Testing
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Operating System :: OS Independent
Classifier: License :: Public Domain
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE

# 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:


```python
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"}]}
```


