跳转到主要内容

一个第三方pytest插件,它提供了一个用于模拟IdNow身份验证服务的 fixture

项目描述

idnow_responses

一个第三方pytest插件,它提供了一个用于模拟IdNow身份验证服务的 fixture。

安装

pip install idnow-responses

用法

此插件使得 idnow_responses fixture 可用。通常对IdNow的请求会位于被测试的代码中,而不是在测试中。为了简单起见,它在这里是请求

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

项目详情


下载文件

为您的平台下载文件。如果您不确定选择哪个,请了解更多关于 安装软件包 的信息。

源代码分发

idnow_responses-0.0.2.tar.gz (3.5 kB 查看散列值)

上传时间

构建分发

idnow_responses-0.0.2-py3-none-any.whl (3.9 kB 查看散列值)

上传时间 Python 3

支持