diff options
Diffstat (limited to 'conductor')
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 |