Allow creation of shots without status.

This commit is contained in:
2016-09-30 12:50:13 +02:00
parent b1783fb801
commit 88c20bf341
4 changed files with 100 additions and 1 deletions

View File

@@ -261,3 +261,46 @@ class PatchShotTest(AbstractShotTest):
}
}
self.patch(url, json=patch, auth_token='other', expected_status=403)
class RequiredAfterCreationTest(AbstractShotTest):
"""
This tests Pillar stuff, but requires attract_shot since that's what the
required_after_creation=False was created for.
Placing the test here was easier than creating a node type in Pillar
specifically for this test case. Once we use that validator in Pillar
itself, we can move this test there too.
"""
def test_create_shot(self):
from attract.node_types import node_type_shot
self.user_id = self.create_project_admin(self.project)
self.create_valid_auth_token(self.user_id, 'token')
node_type_name = node_type_shot['name']
shot = {'name': u'test shot',
'description': u'',
'properties': {u'trim_start_in_frames': 0,
u'duration_in_edit_in_frames': 1,
u'cut_in_timeline_in_frames': 0},
'node_type': node_type_name,
'project': unicode(self.proj_id),
'user': unicode(self.user_id)}
resp = self.post('/api/nodes', json=shot,
auth_token='token', expected_status=201)
info = resp.json()
resp = self.get('/api/nodes/%(_id)s' % info, auth_token='token')
json_shot = resp.json()
self.assertEqual(node_type_shot['dyn_schema']['status']['default'],
json_shot['properties']['status'])
return json_shot
# TODO: should test editing a shot as well, but I had issues with the PillarSDK
# not handling deleting of properties.