diff options
author | DR695H <dr695h@att.com> | 2019-08-20 12:37:45 -0400 |
---|---|---|
committer | DR695H <dr695h@att.com> | 2019-08-20 12:37:45 -0400 |
commit | 4ab02dddd76c37467b56f097dd24b7fef134d5e5 (patch) | |
tree | 8d45148a7b2560fb6aeac007d974f353005ea91e /robotframework-onap | |
parent | afd5237ef7c1d46e2d8b3eebe890e20818424e18 (diff) |
str for aai properties and adding a test
Issue-ID: TEST-184
Change-Id: I489e55835bad95d9b35419edbcb892d3e228bced
Signed-off-by: DR695H <dr695h@att.com>
Diffstat (limited to 'robotframework-onap')
-rw-r--r-- | robotframework-onap/ONAPLibrary/BaseAAIKeywords.py | 2 | ||||
-rw-r--r-- | robotframework-onap/tests/ONAPLibrary/AAITests.py | 33 | ||||
-rw-r--r-- | robotframework-onap/tests/ONAPLibrary/Base64KeywordsTests.py | 13 | ||||
-rw-r--r-- | robotframework-onap/tests/runner.py | 2 |
4 files changed, 49 insertions, 1 deletions
diff --git a/robotframework-onap/ONAPLibrary/BaseAAIKeywords.py b/robotframework-onap/ONAPLibrary/BaseAAIKeywords.py index fdc9e84..0b312df 100644 --- a/robotframework-onap/ONAPLibrary/BaseAAIKeywords.py +++ b/robotframework-onap/ONAPLibrary/BaseAAIKeywords.py @@ -33,7 +33,7 @@ class BaseAAIKeywords(object): aai_ip_addr = self.vars.get_globally_injected_parameters().get('GLOBAL_INJECTED_AAI_IP_ADDR', '') aai_server_protocol = self.vars.get_global_parameters().get('GLOBAL_AAI_SERVER_PROTOCOL', '') aai_server_port = self.vars.get_global_parameters().get('GLOBAL_AAI_SERVER_PORT', '') - self.aai_endpoint = aai_server_protocol + '://' + aai_ip_addr + ':' + aai_server_port + self.aai_endpoint = str(aai_server_protocol) + '://' + str(aai_ip_addr) + ':' + str(aai_server_port) @keyword def run_get_request(self, endpoint, data_path, accept="application/json", auth=None, client_certs=None): diff --git a/robotframework-onap/tests/ONAPLibrary/AAITests.py b/robotframework-onap/tests/ONAPLibrary/AAITests.py new file mode 100644 index 0000000..0f5686e --- /dev/null +++ b/robotframework-onap/tests/ONAPLibrary/AAITests.py @@ -0,0 +1,33 @@ +# Copyright 2019 AT&T Intellectual Property. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import requests_mock +from unittest import TestCase +from unittest import main + +from ONAPLibrary.AAI import AAI + + +class AAITests(TestCase): + + def test_get(self): + with requests_mock.mock() as m: + aai = AAI() + m.get('http://test.com/', text='data') + resp = aai.run_get_request(endpoint="http://test.com", data_path="/", + accept="application/json", auth={"user", "pass"}) + self.assertEqual("data", resp.text) + + if __name__ == '__main__': + main() diff --git a/robotframework-onap/tests/ONAPLibrary/Base64KeywordsTests.py b/robotframework-onap/tests/ONAPLibrary/Base64KeywordsTests.py index 4c63591..192f289 100644 --- a/robotframework-onap/tests/ONAPLibrary/Base64KeywordsTests.py +++ b/robotframework-onap/tests/ONAPLibrary/Base64KeywordsTests.py @@ -1,3 +1,16 @@ +# Copyright 2019 AT&T Intellectual Property. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. import base64 from unittest import TestCase diff --git a/robotframework-onap/tests/runner.py b/robotframework-onap/tests/runner.py index a2fd5b7..efee7c5 100644 --- a/robotframework-onap/tests/runner.py +++ b/robotframework-onap/tests/runner.py @@ -9,12 +9,14 @@ from tests.ONAPLibrary.UUIDKeywordsTest import UUIDKeywordsTest from tests.ONAPLibrary.ServiceMappingKeywordsTests import ServiceMappingKeywordsTests from tests.ONAPLibrary.Base64KeywordsTests import Base64KeywordsTests from tests.ONAPLibrary.RequestsHelperTests import RequestsHelperTests +from tests.ONAPLibrary.AAITests import AAITests # initialize the test suite loader = TestLoader() suite = TestSuite() # add tests to the test suite +suite.addTests(loader.loadTestsFromTestCase(AAITests)) suite.addTests(loader.loadTestsFromTestCase(ProtobufKeywordsTest)) suite.addTests(loader.loadTestsFromTestCase(SoUtilsTest)) suite.addTests(loader.loadTestsFromTestCase(UUIDKeywordsTest)) |