Exemplo n.º 1
0
def test_decipher_response_301_with_message() -> None:
    status = 301
    headers = {"content-type": "application/vnd.schemaregistry.v1+json"}
    body = json.dumps({"error": 12345, "message": "I've got reasons"}).encode(
        "utf-8"
    )
    with pytest.raises(RegistryRedirectionError):
        decipher_response(status, headers, body)
Exemplo n.º 2
0
def test_decipher_response_200() -> None:
    status = 200
    headers = {"content-type": "application/vnd.schemaregistry.v1+json"}
    data = [1, 2, 3]
    body = json.dumps(data).encode("utf-8")
    returned_data = decipher_response(status, headers, body)
    assert returned_data == data
Exemplo n.º 3
0
def test_decipher_response_301_no_message() -> None:
    status = 301
    headers = {"content-type": "application/vnd.schemaregistry.v1+json"}
    body = b""
    with pytest.raises(RegistryRedirectionError):
        decipher_response(status, headers, body)
Exemplo n.º 4
0
def test_decipher_response_200_empty() -> None:
    status = 200
    headers = {"content-type": "application/vnd.schemaregistry.v1+json"}
    body = b""
    returned_data = decipher_response(status, headers, body)
    assert returned_data is None