summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShankaranarayanan Puzhavakath Narayanan <snarayanan@research.att.com>2018-03-14 03:19:17 +0000
committerGerrit Code Review <gerrit@onap.org>2018-03-14 03:19:17 +0000
commite4cee54e5b2bf43b3da857866036b1d178ee9617 (patch)
tree6b6a2421a68099b90e60e8573e1c9c007453f89f
parent3871d29d2414548083b1308298517562e6728117 (diff)
parentaeb730c21aebede0a7df2b29247afa6fc473b73c (diff)
Merge "Added more unit test cases in aai.py file"
-rw-r--r--conductor/conductor/tests/unit/data/plugins/inventory_provider/_cached_complex.json8
-rw-r--r--conductor/conductor/tests/unit/data/plugins/inventory_provider/relationship_list.json20
-rw-r--r--conductor/conductor/tests/unit/data/plugins/inventory_provider/test_aai.py14
3 files changed, 40 insertions, 2 deletions
diff --git a/conductor/conductor/tests/unit/data/plugins/inventory_provider/_cached_complex.json b/conductor/conductor/tests/unit/data/plugins/inventory_provider/_cached_complex.json
new file mode 100644
index 0000000..9dd4514
--- /dev/null
+++ b/conductor/conductor/tests/unit/data/plugins/inventory_provider/_cached_complex.json
@@ -0,0 +1,8 @@
+{
+ "country": "USA",
+ "region": "SE",
+ "latitude": "28.543251",
+ "longitude": "-81.377112",
+ "city": "Middletwon",
+ "state": "NJ"
+} \ No newline at end of file
diff --git a/conductor/conductor/tests/unit/data/plugins/inventory_provider/relationship_list.json b/conductor/conductor/tests/unit/data/plugins/inventory_provider/relationship_list.json
new file mode 100644
index 0000000..feba03b
--- /dev/null
+++ b/conductor/conductor/tests/unit/data/plugins/inventory_provider/relationship_list.json
@@ -0,0 +1,20 @@
+{
+ "relationship-list": {
+ "relationship": [
+ {
+ "related-to": "service-instance",
+ "related-link": "relationship-link",
+ "relationship-data": [
+ {
+ "relationship-key": "customer.global-customer-id",
+ "relationship-value": "customer-id"
+ },
+ {
+ "relationship-key": "service-subscription.service-type",
+ "relationship-value": "service-type"
+ }
+ ]
+ }
+ ]
+ }
+ } \ No newline at end of file
diff --git a/conductor/conductor/tests/unit/data/plugins/inventory_provider/test_aai.py b/conductor/conductor/tests/unit/data/plugins/inventory_provider/test_aai.py
index 30a54a9..802168f 100644
--- a/conductor/conductor/tests/unit/data/plugins/inventory_provider/test_aai.py
+++ b/conductor/conductor/tests/unit/data/plugins/inventory_provider/test_aai.py
@@ -21,6 +21,7 @@ import unittest
import mock
import conductor.data.plugins.inventory_provider.aai as aai
from conductor.data.plugins.inventory_provider.aai import AAI
+from conductor.common import rest
from oslo_config import cfg
class TestAAI(unittest.TestCase):
@@ -217,7 +218,7 @@ class TestAAI(unittest.TestCase):
regions_response_file = './conductor/tests/unit/data/plugins/inventory_provider/cache_regions.json'
regions_response = json.loads(open(regions_response_file).read())
- complex_json_file = './conductor/tests/unit/data/plugins/inventory_provider/_get_complex.json'
+ complex_json_file = './conductor/tests/unit/data/plugins/inventory_provider/_cached_complex.json'
complex_json = json.loads(open(complex_json_file).read())
response = mock.MagicMock()
@@ -232,4 +233,13 @@ class TestAAI(unittest.TestCase):
self.mock_get_complex.start()
self.assertEqual(None,
- self.aai_ep._refresh_cache()) \ No newline at end of file
+ self.aai_ep._refresh_cache())
+
+ def test_get_aai_rel_link(self):
+
+ relatonship_response_file = './conductor/tests/unit/data/plugins/inventory_provider/relationship_list.json'
+ relatonship_response = json.loads(open(relatonship_response_file).read())
+ related_to = "service-instance"
+
+ self.assertEqual("relationship-link",
+ self.aai_ep._get_aai_rel_link(relatonship_response, related_to)) \ No newline at end of file