From 728465bc139a4a2b78ac389ffd53e2454ee58716 Mon Sep 17 00:00:00 2001
From: Erik Reid <erik.reid@geant.org>
Date: Thu, 12 Dec 2019 14:36:07 +0100
Subject: [PATCH] added a unit test for opsdb.get_service_users

---
 test/test_opsdb_queries.py | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/test/test_opsdb_queries.py b/test/test_opsdb_queries.py
index 2fc43bdd..7ef564c2 100644
--- a/test/test_opsdb_queries.py
+++ b/test/test_opsdb_queries.py
@@ -164,3 +164,30 @@ def test_equipment_location(connection, equipment):
 def test_coriant_path(connection, equipment, card, port):
     circuit = opsdb.lookup_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
+            }
+        },
+
+        'type': 'array',
+        'items': {'$ref': '#/definitions/service-user'}
+    }
+
+    service_id_list = [47673, 47675]
+    users = opsdb.get_service_users(connection, service_id_list)
+    users = list(users)
+    jsonschema.validate(users, schema)
+    assert users
-- 
GitLab