def test_create_group_does_not_a_uuid(self): self.mock_object( self.controller.share_group_api, 'create_share_group_snapshot', mock.Mock(side_effect=exception.ShareGroupNotFound( share_group_id='not_a_uuid', ))) body = {"share_group_snapshot": {"share_group_id": "not_a_uuid"}} self.assertRaises(webob.exc.HTTPBadRequest, self.controller.create, self.request, body) self.mock_policy_check.assert_called_once_with(self.context, self.resource_name, 'create')
def test_create_group_does_not_exist(self): fake_id = six.text_type(uuidutils.generate_uuid()) body = {"share_group_snapshot": {"share_group_id": fake_id}} self.mock_object( self.controller.share_group_api, 'create_share_group_snapshot', mock.Mock(side_effect=exception.ShareGroupNotFound( share_group_id=six.text_type(uuidutils.generate_uuid())))) self.assertRaises( webob.exc.HTTPBadRequest, self.controller.create, self.request, body) self.mock_policy_check.assert_called_once_with( self.context, self.resource_name, 'create')