Exemple #1
0
 def test_upload_update(self):
     delta = Delta(lambda: self.record.versions.count(), lambda value: value + 1)
     with AssertDeltas(delta):
         res = self.send_upload_hook(self.node_settings.get_root(), self.project, self.make_payload())
         self.record.reload()
     assert_equal(res.status_code, 200)
     assert_equal(res.json['status'], 'success')
     version = models.FileVersion.load(res.json['version'])
     assert_is_not(version, None)
     assert_in(version, self.record.versions.all())
Exemple #2
0
 def test_upload_duplicate(self):
     location = {
         'service': 'cloud',
         storage_settings.WATERBUTLER_RESOURCE: 'osf',
         'object': 'file',
     }
     version = self.record.create_version(self.user, location)
     with AssertDeltas(Delta(lambda: self.record.versions.count())):
         res = self.send_upload_hook(self.node_settings.get_root(), payload=self.make_payload())
         self.record.reload()
     assert_equal(res.status_code, 200)
     assert_equal(res.json['status'], 'success')
     version = models.FileVersion.load(res.json['version'])
     assert_is_not(version, None)
     assert_in(version, self.record.versions.all())