summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZuul <zuul@review.openstack.org>2018-12-02 06:18:09 +0000
committerGerrit Code Review <review@openstack.org>2018-12-02 06:18:09 +0000
commitc6605f15938f2830f5e3a0321ff971130a3417f3 (patch)
tree3cf0371c07fd885611555614131c28040d93366c
parent18dcda1ee0ac211d84a1d78499e62be92f91fa9b (diff)
parentc74b622ff77a3cdf1dfabe34919174391c4a0d95 (diff)
Merge "add a unitest for api of verification"
-rwxr-xr-x[-rw-r--r--]karbor/tests/unit/api/v1/test_verifications.py25
1 files changed, 21 insertions, 4 deletions
diff --git a/karbor/tests/unit/api/v1/test_verifications.py b/karbor/tests/unit/api/v1/test_verifications.py
index 39a05fa..ba892da 100644..100755
--- a/karbor/tests/unit/api/v1/test_verifications.py
+++ b/karbor/tests/unit/api/v1/test_verifications.py
@@ -76,19 +76,36 @@ class VerificationApiTest(base.TestCase):
76 @mock.patch( 76 @mock.patch(
77 'karbor.api.v1.verifications.' 77 'karbor.api.v1.verifications.'
78 'VerificationsController._get_all') 78 'VerificationsController._get_all')
79 def test_verification_list_detail(self, moak_get_all): 79 def test_verification_list_detail(self, mock_get_all):
80 req = fakes.HTTPRequest.blank('/v1/verifications') 80 req = fakes.HTTPRequest.blank('/v1/verifications')
81 self.controller.index(req) 81 self.controller.index(req)
82 self.assertTrue(moak_get_all.called) 82 self.assertTrue(mock_get_all.called)
83
84 @mock.patch(
85 'karbor.api.v1.verifications.'
86 'VerificationsController._get_all')
87 @mock.patch('karbor.api.common.ViewBuilder._get_collection_links')
88 def test_verification_list_detail_with_verifications_links(self,
89 mock_get_links,
90 mock_get_all):
91 except_value = [{
92 "rel": "next",
93 "href": "/v1/verifications?marker"
94 }]
95 req = fakes.HTTPRequest.blank('/v1/verifications')
96 mock_get_links.return_value = except_value
97 return_value = self.controller.index(req)
98 self.assertTrue(mock_get_all.called)
99 self.assertEqual(return_value['verifications_links'], except_value)
83 100
84 @mock.patch( 101 @mock.patch(
85 'karbor.api.v1.verifications.' 102 'karbor.api.v1.verifications.'
86 'VerificationsController._verification_get') 103 'VerificationsController._verification_get')
87 def test_verification_show(self, moak_verification_get): 104 def test_verification_show(self, mock_verification_get):
88 req = fakes.HTTPRequest.blank('/v1/verifications') 105 req = fakes.HTTPRequest.blank('/v1/verifications')
89 self.controller.show( 106 self.controller.show(
90 req, '2a9ce1f3-cc1a-4516-9435-0ebb13caa398') 107 req, '2a9ce1f3-cc1a-4516-9435-0ebb13caa398')
91 self.assertTrue(moak_verification_get.called) 108 self.assertTrue(mock_verification_get.called)
92 109
93 def test_verification_show_Invalid(self): 110 def test_verification_show_Invalid(self):
94 req = fakes.HTTPRequest.blank('/v1/verifications/1') 111 req = fakes.HTTPRequest.blank('/v1/verifications/1')