str for aai properties and adding a test 83/93983/1
authorDR695H <dr695h@att.com>
Tue, 20 Aug 2019 16:37:45 +0000 (12:37 -0400)
committerDR695H <dr695h@att.com>
Tue, 20 Aug 2019 16:37:45 +0000 (12:37 -0400)
Issue-ID: TEST-184
Change-Id: I489e55835bad95d9b35419edbcb892d3e228bced
Signed-off-by: DR695H <dr695h@att.com>
robotframework-onap/ONAPLibrary/BaseAAIKeywords.py
robotframework-onap/tests/ONAPLibrary/AAITests.py [new file with mode: 0644]
robotframework-onap/tests/ONAPLibrary/Base64KeywordsTests.py
robotframework-onap/tests/runner.py

index fdc9e84..0b312df 100644 (file)
@@ -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 (file)
index 0000000..0f5686e
--- /dev/null
@@ -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()
index 4c63591..192f289 100644 (file)
@@ -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
 
index a2fd5b7..efee7c5 100644 (file)
@@ -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))