Eager loading on One-to-X foreign keys
In this changeset, I added ORM relationships to the DB models concerning the already-declared foreign keys. I also modified the DB query building to now handle a new 'eager' parameter that, if True, is responsible to also fetch the data relative to these 'parent' DB entities (no cascading). Change-Id: Ieea181af9a4b173c54621dcc6c549161f5a35aeb Partially-Implements: blueprint watcher-versioned-objects
This commit is contained in:
@@ -504,24 +504,6 @@ class TestPatchStateTransitionDenied(api_base.FunctionalTest):
|
||||
self.assertTrue(response.json['error_message'])
|
||||
|
||||
|
||||
class TestPatchStateDeletedNotFound(api_base.FunctionalTest):
|
||||
|
||||
@mock.patch.object(
|
||||
db_api.BaseConnection, 'update_action_plan',
|
||||
mock.Mock(side_effect=lambda ap: ap.save() or ap))
|
||||
def test_replace_state_pending_not_found(self):
|
||||
action_plan = obj_utils.create_test_action_plan(
|
||||
self.context, state=objects.action_plan.State.DELETED)
|
||||
|
||||
response = self.get_json(
|
||||
'/action_plans/%s' % action_plan.uuid,
|
||||
expect_errors=True
|
||||
)
|
||||
self.assertEqual(404, response.status_code)
|
||||
self.assertEqual('application/json', response.content_type)
|
||||
self.assertTrue(response.json['error_message'])
|
||||
|
||||
|
||||
class TestPatchStateTransitionOk(api_base.FunctionalTest):
|
||||
|
||||
scenarios = [
|
||||
|
||||
Reference in New Issue
Block a user