Added etag checking when saving tasks & shots. Still a bit rough.
Needs nicer user interface stuff for explaining what's going on.
This commit is contained in:
@@ -4,6 +4,7 @@ import responses
|
||||
from bson import ObjectId
|
||||
|
||||
import pillarsdk
|
||||
import pillarsdk.exceptions as sdk_exceptions
|
||||
import pillar.tests
|
||||
import pillar.auth
|
||||
import pillar.tests.common_test_data as ctd
|
||||
@@ -94,10 +95,19 @@ class ShotManagerTest(AbstractAttractTest):
|
||||
|
||||
self.mock_blenderid_validate_happy()
|
||||
|
||||
self.assertRaises(sdk_exceptions.PreconditionFailed,
|
||||
self.smngr.edit_shot,
|
||||
shot_id=shot['_id'],
|
||||
name=u'ผัดไทย',
|
||||
description=u'Shoot the Pad Thai',
|
||||
status='todo',
|
||||
_etag='jemoeder')
|
||||
|
||||
self.smngr.edit_shot(shot_id=shot['_id'],
|
||||
name=u'ผัดไทย',
|
||||
description=u'Shoot the Pad Thai',
|
||||
status='todo')
|
||||
status='todo',
|
||||
_etag=shot._etag)
|
||||
|
||||
# Test directly with MongoDB
|
||||
with self.app.test_request_context():
|
||||
@@ -107,4 +117,3 @@ class ShotManagerTest(AbstractAttractTest):
|
||||
self.assertEqual(u'todo', found['properties']['status'])
|
||||
self.assertEqual(u'Shoot the Pad Thai', found['description'])
|
||||
self.assertNotIn(u'notes', found['properties'])
|
||||
|
||||
|
@@ -4,6 +4,7 @@ import responses
|
||||
from bson import ObjectId
|
||||
|
||||
import pillarsdk
|
||||
import pillarsdk.exceptions as sdk_exceptions
|
||||
import pillar.api.utils
|
||||
import pillar.tests
|
||||
import pillar.auth
|
||||
@@ -59,11 +60,20 @@ class TaskWorkflowTest(AbstractAttractTest):
|
||||
pillar.auth.login_user(ctd.EXAMPLE_PROJECT_OWNER_ID)
|
||||
|
||||
self.mock_blenderid_validate_happy()
|
||||
self.assertRaises(sdk_exceptions.PreconditionFailed,
|
||||
self.mngr.edit_task,
|
||||
task._id,
|
||||
task_type=u'je møder',
|
||||
name=u'nööw name',
|
||||
description=u'€ ≠ ¥',
|
||||
status='todo',
|
||||
_etag='jemoeder')
|
||||
self.mngr.edit_task(task._id,
|
||||
task_type=u'je møder',
|
||||
name=u'nööw name',
|
||||
description=u'€ ≠ ¥',
|
||||
status='todo')
|
||||
status='todo',
|
||||
_etag=task._etag)
|
||||
|
||||
# Test directly with MongoDB
|
||||
with self.app.test_request_context():
|
||||
|
Reference in New Issue
Block a user