From: Liang Ke Date: Tue, 27 Mar 2018 02:25:23 +0000 (+0000) Subject: Merge "Add test_download_file_from_http_success" X-Git-Tag: v1.1.2~29 X-Git-Url: https://gerrit.onap.org/r/gitweb?p=multicloud%2Fframework.git;a=commitdiff_plain;h=2321a26923f2e363d084124cfa2d59f59702ad71;hp=cd363b6f336f181b01bbf4fbb9c0a8c1da3ab00a Merge "Add test_download_file_from_http_success" --- diff --git a/.gitignore b/.gitignore index 9787425..a5beebe 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ .project .classpath +.vscode .settings/ .checkstyle target/ diff --git a/docs/MultCloud-Test-CSIT.rst b/docs/MultCloud-Test-CSIT.rst new file mode 100644 index 0000000..63fd87f --- /dev/null +++ b/docs/MultCloud-Test-CSIT.rst @@ -0,0 +1,18 @@ +Clone integration repo + + git clone http://gerrit.onap.org/r/integration + +Setup more contains if needed + +The file 'setup.sh' under 'test/csit/plans/multicloud/functionality1' will setup multicloud containers for CSIT test. +Add more tests + +The file 'testplan.txt' under 'test/csit/plans/multicloud/functionality1/' specific the robot tests to be run. + +The content of 'testplan.txt' will looks like following: + + # Test suites are relative paths under [integration.git]/test/csit/tests/. + # Place the suites in run order. + multicloud/provision/sanity_test_multivim.robot + +When adding tests to file 'multicloud/provision/sanity_test_multivim.robot' , a 'verify-csit' job will be trigger for related patch, and related change will be tested. diff --git a/multivimbroker/multivimbroker/tests/test_restcall.py b/multivimbroker/multivimbroker/tests/test_restcall.py index 235d58a..8ac1948 100644 --- a/multivimbroker/multivimbroker/tests/test_restcall.py +++ b/multivimbroker/multivimbroker/tests/test_restcall.py @@ -18,8 +18,8 @@ class TestRestCall(unittest.TestCase): def test_combine_url(self): url = ["http://a.com/test/", "http://a.com/test/", - "http://a.com/test"] - res = ["/resource", "resource", "/resource"] + "http://a.com/test", "http://a.com/test"] + res = ["/resource", "resource", "/resource", "resource"] expected = "http://a.com/test/resource" for i in range(len(url)): self.assertEqual(expected, restcall.combine_url(url[i], res[i])) @@ -53,3 +53,15 @@ class TestRestCall(unittest.TestCase): mock_call.assert_called_once_with( expect_url, "", "", restcall.rest_no_auth, res, method, content, headers) + + @mock.patch("httplib2.Http.request") + def test_call_req_success(self, mock_req): + mock_resp = { + "status": "200" + } + resp_content = "hello" + mock_req.return_value = mock_resp, resp_content + expect_ret = [0, resp_content, "200", mock_resp] + ret = restcall.call_req("http://onap.org/", "user", "pass", + restcall.rest_no_auth, "vim", "GET") + self.assertEqual(expect_ret, ret)