Skip to content
Snippets Groups Projects
Commit 766bfb57 authored by Erik Reid's avatar Erik Reid
Browse files

forgot to actually test the api in 2nd method

parent 9fd25071
Branches
Tags
No related merge requests found
......@@ -167,34 +167,34 @@ def test_coriant_path(connection, equipment, card, port):
jsonschema.validate(circuit, CORIANT_PATH_METADATA)
def test_get_service_users(connection):
schema = {
'$schema': 'http://json-schema.org/draft-07/schema#',
'definitions': {
'service-user': {
'type': 'object',
'properties': {
'service_id': {'type': 'integer'},
'user': {'type': 'string'}
},
'required': ['service_id', 'user'],
'additionalProperties': False
}
},
SERVICE_USER_LIST_SCHEMA = {
'$schema': 'http://json-schema.org/draft-07/schema#',
'definitions': {
'service-user': {
'type': 'object',
'properties': {
'service_id': {'type': 'integer'},
'user': {'type': 'string'}
},
'required': ['service_id', 'user'],
'additionalProperties': False
}
},
'type': 'array',
'items': {'$ref': '#/definitions/service-user'}
}
'type': 'array',
'items': {'$ref': '#/definitions/service-user'}
}
def test_get_service_users(connection):
service_id_list = [47673, 47675]
users = opsdb.get_service_users(connection, service_id_list)
users = list(users)
jsonschema.validate(users, schema)
jsonschema.validate(users, SERVICE_USER_LIST_SCHEMA)
assert users
def test_get_all_service_users(connection, cached_test_data):
def _all_interfaces():
......@@ -218,8 +218,11 @@ def test_get_all_service_users(connection, cached_test_data):
ids = {s['service_id'] for s in _all_service_ids(_all_interfaces())}
assert len(ids) > 0
#
# services = {}
service_users = list(opsdb.get_service_users(connection, list(ids)))
jsonschema.validate(service_users, SERVICE_USER_LIST_SCHEMA)
assert service_users
# for user in opsdb.get_service_users(connection, list(ids)):
# services.setdefault(user['service_id'], []).append(user['user'])
#
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment