def test_extend(self): id = 'fake_share_id' share = stubs.stub_share_get(None, None, id) self.mock_object(share_api.API, 'get', mock.Mock(return_value=share)) self.mock_object(share_api.API, "extend") size = '123' body = {"os-extend": {'new_size': size}} req = fakes.HTTPRequest.blank('/v1/shares/%s/action' % id) actual_response = self.controller._extend(req, id, body) share_api.API.get.assert_called_once_with(mock.ANY, id) share_api.API.extend.assert_called_once_with(mock.ANY, share, int(size)) self.assertEqual(202, actual_response.status_int)
def test_shrink(self): id = 'fake_share_id' share = stubs.stub_share_get(None, None, id) self.mock_object(share_api.API, 'get', mock.Mock(return_value=share)) self.mock_object(share_api.API, "shrink") size = '123' body = {"os-shrink": {'new_size': size}} req = fakes.HTTPRequest.blank('/v1/shares/%s/action' % id) actual_response = self.controller._shrink(req, id, body) share_api.API.get.assert_called_once_with(mock.ANY, id) share_api.API.shrink.assert_called_once_with( mock.ANY, share, int(size)) self.assertEqual(202, actual_response.status_int)