summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZuul <zuul@review.openstack.org>2018-11-27 01:21:37 +0000
committerGerrit Code Review <review@openstack.org>2018-11-27 01:21:37 +0000
commit6deaf213dc4a55072d7c2b12d74e65fa180ecdb3 (patch)
treefd56d5f7602ced134c49e48c7757b2172cd35bf1
parent64c7c8f9895cef1e5de0fd0206527c6592b2c1b2 (diff)
parent50dc879eafa2326fa16b2d3904af0ec4781935ba (diff)
Merge "Add unit test for restores API"
-rw-r--r--karbor/tests/unit/api/v1/test_restores.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/karbor/tests/unit/api/v1/test_restores.py b/karbor/tests/unit/api/v1/test_restores.py
index 79fb177..ad9dbe2 100644
--- a/karbor/tests/unit/api/v1/test_restores.py
+++ b/karbor/tests/unit/api/v1/test_restores.py
@@ -93,6 +93,30 @@ class RestoreApiTest(base.TestCase):
93 self.assertTrue(moak_get_all.called) 93 self.assertTrue(moak_get_all.called)
94 94
95 @mock.patch( 95 @mock.patch(
96 'karbor.api.v1.restores.RestoresController._get_all')
97 def test_restore_index_limit_offset(self, mock_get_all):
98 req = fakes.HTTPRequest.blank(
99 '/v1/restores?limit=2&offset=1')
100 self.controller.index(req)
101 self.assertTrue(mock_get_all.called)
102
103 req = fakes.HTTPRequest.blank('/v1/restores?limit=-1&offset=1')
104 self.assertRaises(exc.HTTPBadRequest,
105 self.controller.index,
106 req)
107
108 req = fakes.HTTPRequest.blank('/v1/restores?limit=a&offset=1')
109 self.assertRaises(exc.HTTPBadRequest,
110 self.controller.index,
111 req)
112
113 url = '/v1/restores?limit=2&offset=43543564546567575'
114 req = fakes.HTTPRequest.blank(url)
115 self.assertRaises(exc.HTTPBadRequest,
116 self.controller.index,
117 req)
118
119 @mock.patch(
96 'karbor.api.v1.restores.RestoresController.' 120 'karbor.api.v1.restores.RestoresController.'
97 '_restore_get') 121 '_restore_get')
98 def test_restore_show(self, moak_restore_get): 122 def test_restore_show(self, moak_restore_get):