Don't undelete when unlinking a deleted shot.

This commit is contained in:
2016-11-04 13:41:58 +01:00
parent e7126edd7a
commit 9ec08efc40
2 changed files with 28 additions and 3 deletions

View File

@@ -355,6 +355,28 @@ class PatchShotTest(AbstractShotTest):
dbnode = self.get(url, auth_token='token').json()
self.assertFalse(dbnode['properties']['used_in_edit'])
@responses.activate
def test_patch_unlink_deleted(self):
"""Unlinking a deleted shot shouldn't undelete it.
We implement PATCH by changing then PUTing, which undeletes by default.
"""
shot = self.create_shot()
self.create_valid_auth_token(ctd.EXAMPLE_PROJECT_OWNER_ID, 'token')
url = '/api/nodes/%s' % shot._id
# Delete (and verify deletion)
self.delete(url, auth_token='token',
headers={'If-Match': shot['_etag']},
expected_status=204)
self.get(url, auth_token='token', expected_status=404)
patch = {'op': 'unlink'}
self.patch(url, json=patch, auth_token='token')
self.get(url, auth_token='token', expected_status=404)
@responses.activate
def test_patch_relink(self):
shot = self.create_shot()