diff options
author | rl001m <ruilu@research.att.com> | 2018-03-13 14:36:52 -0400 |
---|---|---|
committer | rl001m <ruilu@research.att.com> | 2018-03-13 14:37:07 -0400 |
commit | aeb730c21aebede0a7df2b29247afa6fc473b73c (patch) | |
tree | ccba31d5b8bdf443563a8c4f5d668636d7bd1f21 /conductor | |
parent | 6b4a181efbe7234074539ee9b2abed72fd7af964 (diff) |
Added more unit test cases in aai.py file
Added more unit tests for AAI.
get_aai_rel_link and get_aai_rel_link_data Usage
Change-Id: Ie5bc835013da5333b7e2c6f19f48ad8910793643
Issue-ID: OPTFRA-101
Signed-off-by: rl001m <ruilu@research.att.com>
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 |