Commit 978f082e authored by Arthur Lutz's avatar Arthur Lutz
Browse files

[test/test_s3storage] add a test for two identical files created in same transaction

parent f657582ffdf4
......@@ -41,6 +41,17 @@ class S3StorageTC(testing.S3StorageTestMixin, CubicWebTC):
data = self.s3_bucket.Object(key).get()['Body'].read()
self.assertEqual(data, b'some content')
def test_entity_create_two_files_in_transaction(self):
with self.admin_access.client_cnx() as cnx:
eid = create_image(cnx, b'some content').eid
_ = create_image(cnx, b'some content').eid
cnx.commit()
key = cnx.execute('Any STKEY(D) WHERE X is Image, X data D, '
'X eid %(eid)s', {'eid': eid}).rows[0][0]
key = key.getvalue().decode()
data = self.s3_bucket.Object(key).get()['Body'].read()
self.assertEqual(data, b'some content')
def test_entity_modify(self):
with self.admin_access.client_cnx() as cnx:
eid = create_image(cnx, b'some content').eid
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment