Beispiel #1
0
 def setUp(self):
     super(TestGetRevisions, self).setUp()
     self.path = 'tie/your/mother/down.mp3'
     self.record = recursively_create_file(self.node_settings, self.path)
     self.record.versions = [
         factories.FileVersionFactory() for __ in range(15)
     ]
     self.record.save()
Beispiel #2
0
 def setUp(self):
     super(TestUpdateMetadataHook, self).setUp()
     self.path = 'greasy/pízza.png'
     self.record = recursively_create_file(self.node_settings, self.path)
     self.version = factories.FileVersionFactory()
     self.record.versions = [self.version]
     self.record.save()
     self.payload = {
         'metadata': {'archive': 'glacier', 'size': 123, 'modified': 'Mon, 16 Feb 2015 18:45:34 GMT'},
         'version': self.version._id,
         'size': 123,
     }
Beispiel #3
0
 def test_children_metata(self):
     path = u'kind/of/magíc.mp3'
     record = recursively_create_file(self.node_settings, path)
     version = factories.FileVersionFactory()
     record.versions.append(version)
     record.save()
     res = self.send_hook(
         'osfstorage_get_children',
         {'fid': record.parent._id},
         {},
     )
     assert_equal(len(res.json), 1)
     assert_equal(res.json[0], record.serialized())
Beispiel #4
0
 def test_file_metata(self):
     path = u'kind/of/magíc.mp3'
     record = recursively_create_file(self.node_settings, path)
     version = factories.FileVersionFactory()
     record.versions.append(version)
     record.save()
     res = self.send_hook(
         'osfstorage_get_metadata',
         {'fid': record.parent._id},
         {},
     )
     assert_true(isinstance(res.json, dict))
     assert_equal(res.json, record.parent.serialized(True))
Beispiel #5
0
 def test_file_metdata(self):
     path = u'kind/of/magíc.mp3'
     record = recursively_create_file(self.node_settings, path)
     version = factories.FileVersionFactory()
     record.versions.append(version)
     record.save()
     res = self.send_hook(
         'osfstorage_get_metadata',
         {'fid': record.parent._id},
         {},
     )
     assert_true(isinstance(res.json, dict))
     assert_equal(res.json, record.parent.serialize(True))
Beispiel #6
0
 def test_file_metata(self):
     path = u'kind/of/magíc.mp3'
     record = recursively_create_file(self.node_settings, path)
     version = factories.FileVersionFactory()
     record.versions.append(version)
     record.save()
     res = self.send_hook(
         'osf_storage_get_metadata_hook',
         {'path': record.parent._id},
     )
     assert_equal(len(res.json), 1)
     assert_equal(
         res.json[0],
         record.serialized()
     )
Beispiel #7
0
 def setUp(self):
     super(TestUpdateMetadataHook, self).setUp()
     self.path = 'greasy/pízza.png'
     self.record = recursively_create_file(self.node_settings, self.path)
     self.version = factories.FileVersionFactory()
     self.record.versions = [self.version]
     self.record.save()
     self.payload = {
         'metadata': {
             'size': 123,
             'modified': 'Mon, 16 Feb 2015 18:45:34 GMT',
             'md5': 'askjasdlk;jsadlkjsadf'
         },
         'version': self.version._id,
         'size': 321,  # Just to make sure the field is ignored
     }
Beispiel #8
0
 def setUp(self):
     super(TestUpdateMetadataHook, self).setUp()
     self.path = 'greasy/pízza.png'
     self.record = recursively_create_file(self.node_settings, self.path)
     self.version = factories.FileVersionFactory()
     self.record.versions = [self.version]
     self.record.save()
     self.payload = {
         'metadata': {
             'size': 123,
             'modified': 'Mon, 16 Feb 2015 18:45:34 GMT',
             'md5': 'askjasdlk;jsadlkjsadf'
         },
         'version': self.version._id,
         'size': 321,  # Just to make sure the field is ignored
     }
Beispiel #9
0
 def setUp(self):
     super(TestGetRevisions, self).setUp()
     self.path = 'tie/your/mother/down.mp3'
     self.record = recursively_create_file(self.node_settings, self.path)
     self.record.versions = [factories.FileVersionFactory() for __ in range(15)]
     self.record.save()
Beispiel #10
0
 def setUp(self):
     super(TestUploadFileHook, self).setUp()
     self.path = 'pízza.png'
     self.record = recursively_create_file(self.node_settings, self.path)
     self.auth = make_auth(self.user)