Editing the name of a shot/task/asset now logs the old and new name in the activity

This commit is contained in:
2016-11-10 09:34:32 +01:00
parent 1134bb82a0
commit 497bbb8273
4 changed files with 61 additions and 2 deletions

View File

@@ -170,6 +170,34 @@ class PatchShotTest(AbstractShotTest):
self.assertEqual(123, dbnode['properties']['trim_start_in_frames'])
self.assertEqual(u'on_hold', dbnode['properties']['status'])
@responses.activate
def test_patch_activity(self):
"""Perform the edit, then check the resulting activity on the shot."""
shot = self.create_shot()
self.create_valid_auth_token(ctd.EXAMPLE_PROJECT_OWNER_ID, 'token')
url = '/api/nodes/%s' % shot._id
# Only change the name -- the activity should contain both the old and the new name.
old_name = shot['name']
new_name = u'"shot" is "geschoten" in Dutch'
patch = {
'op': 'from-blender',
'$set': {
'name': new_name,
}
}
self.patch(url, json=patch, auth_token='token')
with self.app.test_request_context():
acts = self.app.pillar_extensions['attract'].activities_for_node(shot._id)
self.assertEqual(2, acts['_meta']['total']) # Creation + edit
edit_act = acts['_items'][1]
self.assertIn(old_name, edit_act['verb'])
self.assertIn(new_name, edit_act['verb'])
pass
@responses.activate
def test_patch_from_web_happy(self):
shot = self.create_shot()