Beispiel #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)
Beispiel #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
Beispiel #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)
Beispiel #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