diff --git a/test/test_general_poller_routes.py b/test/test_general_poller_routes.py index f97ca9552bd7f60fb9c9932d0d450a515428378b..4a40cb4f4ad971370700b45c5ae51faddb286917 100644 --- a/test/test_general_poller_routes.py +++ b/test/test_general_poller_routes.py @@ -155,10 +155,13 @@ def test_gws_indirect_snmp(client): response_data = json.loads(rv.data.decode('utf-8')) jsonschema.validate(response_data, poller.SERVICES_LIST_SCHEMA) - assert response_data # test data is non-empty - # all access services should have snmp info - assert all('snmp' in s for s in response_data) - assert all('counters' in s['snmp'] for s in response_data) + assert response_data # sanity: test data is non-empty + # all operational access services should have snmp info + operational = list(filter( + lambda s: s['status'] == 'operational', response_data)) + assert operational # sanity: test data contains operational services + assert all('snmp' in s for s in operational) + assert all('counters' in s['snmp'] for s in operational) def test_get_services_default(client): @@ -201,9 +204,12 @@ def test_services_snmp(client, service_type): response_data = json.loads(rv.data.decode('utf-8')) jsonschema.validate(response_data, poller.SERVICES_LIST_SCHEMA) - assert response_data # test data is non-empty - # all access services should have snmp info - assert all('snmp' in s for s in response_data) + assert response_data # sanity: test data is non-empty + # operational services should have snmp info + operational = list(filter( + lambda s: s['status'] == 'operational', response_data)) + assert operational # sanity: test data contains operational services + assert all('snmp' in s for s in operational) @pytest.mark.parametrize('uri_type,expected_type', [