Skip to content
Snippets Groups Projects
Commit 5c41910d authored by Maryam Mokhtarifar's avatar Maryam Mokhtarifar
Browse files

Mock whois method in tests.

parent daf602de
No related branches found
No related tags found
1 merge request!49Implement whois method in msr.py and update the response and change the schema of `/asn-peers`
This commit is part of merge request !49. Comments created here will be created in the context of that merge request.
......@@ -338,6 +338,17 @@ def test_get_mdvpn_peerings(client, mocked_redis):
assert response_data # test data is non-empty
@pytest.fixture
def whois(mocker):
check_output = mocker.patch(
"inventory_provider.routes.msr.subprocess.check_output"
)
check_output.return_value = """AS Name
RCCN Fundacao para a Ciencia e a Tecnologia, I.P., PT""".encode(
"utf-8"
)
@pytest.mark.parametrize('endpoint_variant', [
"", # default, no filter
"/1853",
......@@ -348,7 +359,7 @@ def test_get_mdvpn_peerings(client, mocked_redis):
"/1853?instance=IAS",
"/1853?group=IAS-NRENS&instance=IAS"
])
def test_get_asn_peers_get(endpoint_variant, client, mocked_redis):
def test_get_asn_peers_get(endpoint_variant, client, mocked_redis, whois):
rv = client.get(
f'/msr/asn-peers{endpoint_variant}',
headers=DEFAULT_REQUEST_HEADERS
......@@ -370,7 +381,7 @@ def test_get_asn_peers_get(endpoint_variant, client, mocked_redis):
("/1853", '{"instance": "IAS"}'),
("/1853", '{"group": "IAS-NRENS", "instance": "IAS"}')
])
def test_get_asn_peers_post(endpoint_variant, post_body, client, mocked_redis):
def test_get_asn_peers_post(endpoint_variant, post_body, client, mocked_redis, whois):
rv = client.post(
f'/msr/asn-peers{endpoint_variant}',
headers=DEFAULT_REQUEST_HEADERS,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment