def test_cg_create_source_cgsnapshot_does_not_exist(self): fake_snap_id = six.text_type(uuid.uuid4()) body = {"consistency_group": {"source_cgsnapshot_id": fake_snap_id}} self.mock_object( self.controller.cg_api, 'create', mock.Mock(side_effect=exception.CGSnapshotNotFound( cgsnapshot_id=fake_snap_id))) self.assertRaises(webob.exc.HTTPBadRequest, self.controller.create, self.request, body)
def test_cg_create_source_cgsnapshot_does_not_exist(self): fake_snap_id = six.text_type(uuidutils.generate_uuid()) body = {"consistency_group": {"source_cgsnapshot_id": fake_snap_id}} self.mock_object( self.controller.cg_api, 'create', mock.Mock(side_effect=exception.CGSnapshotNotFound( cgsnapshot_id=fake_snap_id))) 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')