Пример #1
0
 def test_add_changes_to_batch(self):
     new_batch = Batch(title="Best Batch Ever")
     new_batch.save()
     add_versions_to_batch(new_batch, changed_items())
     self.assertIn(self.new_author,
                   [bi.version.object for bi
                    in new_batch.batchitem_set.all()])
Пример #2
0
 def test_add_changes_to_batch(self):
     new_batch = Batch(title="Best Batch Ever")
     new_batch.save()
     add_versions_to_batch(new_batch, changed_items())
     self.assertIn(self.new_author,
                   [bi.version.object for bi
                    in new_batch.batchitem_set.all()])
Пример #3
0
 def test_batch_with_deletion(self):
     delete_with_reversion(self.new_author)
     add_versions_to_batch(self.batch, changed_items())
     serialized = serialize_batch(self.key.decode('hex'), self.batch)
     with self.assertRaises(ObjectDoesNotExist):
         process_batch(self.key.decode('hex'), serialized['batch'],
                       serialized['iv'])
Пример #4
0
 def test_batch_with_deletion(self):
     delete_with_reversion(self.new_author)
     add_versions_to_batch(self.batch, changed_items())
     serialized = serialize_batch(self.key.decode('hex'), self.batch)
     with self.assertRaises(ObjectDoesNotExist):
         process_batch(self.key.decode('hex'),
                       serialized['batch'],
                       serialized['iv'])
Пример #5
0
 def test_batch_validation(self):
     batch1 = Batch(title="Best Batch Ever")
     batch1.save()
     batch2 = Batch(title="2nd Best Batch Ever")
     batch2.save()
     add_versions_to_batch(batch1, changed_items())
     add_versions_to_batch(batch2, changed_items())
     with self.assertRaises(BatchValidationError):
         batch1.is_valid(test_only=False)
Пример #6
0
 def test_batch_validation(self):
     batch1 = Batch(title="Best Batch Ever")
     batch1.save()
     batch2 = Batch(title="2nd Best Batch Ever")
     batch2.save()
     add_versions_to_batch(batch1, changed_items())
     add_versions_to_batch(batch2, changed_items())
     with self.assertRaises(BatchValidationError):
         batch1.is_valid(test_only=False)
Пример #7
0
 def test_batch_serialization_and_processing(self):
     add_versions_to_batch(self.batch, changed_items())
     serialized = serialize_batch(self.key.decode('hex'), self.batch)
     process_batch(self.key.decode('hex'),
                   serialized['batch'],
                   serialized['iv'])
Пример #8
0
 def test_batch_serialization_and_processing(self):
     add_versions_to_batch(self.batch, changed_items())
     serialized = serialize_batch(self.key.decode('hex'), self.batch)
     process_batch(self.key.decode('hex'),
                   serialized['batch'],
                   serialized['iv'])