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