async def test_batch_inserts(self, tables_cosmos_account_name, tables_primary_cosmos_account_key): # Arrange await self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key) try: # Act entity = TableEntity() entity.PartitionKey = 'batch_inserts' entity.test = EntityProperty(True, EdmType.BOOLEAN) entity.test2 = 'value' entity.test3 = 3 entity.test4 = EntityProperty(1234567890, EdmType.INT32) transaction_count = 0 batch = [] for i in range(10): entity.RowKey = str(i) batch.append(('create', entity.copy())) transaction_count += 1 transaction_result = await self.table.submit_transaction(batch) # Assert self._assert_valid_batch_transaction(transaction_result, transaction_count) assert 'etag' in transaction_result[0] entities = self.table.query_entities("PartitionKey eq 'batch_inserts'") length = 0 async for e in entities: length += 1 # Assert assert entities is not None assert 10 == length finally: await self._tear_down()
def test_batch_inserts(self, tables_cosmos_account_name, tables_primary_cosmos_account_key): # Arrange self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key, url="cosmos") try: # Act entity = TableEntity() entity['PartitionKey'] = 'batch_inserts' entity['test'] = EntityProperty(True, EdmType.BOOLEAN) entity['test2'] = 'value' entity['test3'] = 3 entity['test4'] = EntityProperty(1234567890, EdmType.INT32) transaction_count = 0 batch = [] for i in range(100): entity['RowKey'] = str(i) batch.append(('create', entity.copy())) transaction_count += 1 transaction_result = self.table.submit_transaction(batch) # Assert self._assert_valid_batch_transaction(transaction_result, transaction_count) assert 'etag' in transaction_result[0] entities = list(self.table.query_entities("PartitionKey eq 'batch_inserts'")) # Assert assert entities is not None assert transaction_count == len(entities) e = self.table.get_entity('batch_inserts', '1') finally: self._tear_down()
async def test_batch_sas_auth(self, tables_cosmos_account_name, tables_primary_cosmos_account_key): # this can be reverted to set_bodiless_matcher() after tests are re-recorded and don't contain these headers set_custom_default_matcher( compare_bodies=False, excluded_headers= "Authorization,Content-Length,x-ms-client-request-id,x-ms-request-id" ) # Arrange await self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key, url="cosmos") try: token = self.generate_sas( generate_table_sas, tables_primary_cosmos_account_key, self.table_name, permission=TableSasPermissions(add=True, read=True, update=True, delete=True), expiry=datetime.utcnow() + timedelta(hours=1), start=datetime.utcnow() - timedelta(minutes=1), ) token = AzureSasCredential(token) # Act service = TableServiceClient( self.account_url(tables_cosmos_account_name, "cosmos"), credential=token, ) table = service.get_table_client(self.table_name) entity = TableEntity() entity['PartitionKey'] = 'batch_inserts' entity['test'] = EntityProperty(True, EdmType.BOOLEAN) entity['test2'] = 'value' entity['test3'] = 3 entity['test4'] = EntityProperty(1234567890, EdmType.INT32) batch = [] transaction_count = 0 for i in range(10): entity['RowKey'] = str(i) batch.append(('create', entity.copy())) transaction_count += 1 transaction_result = await table.submit_transaction(batch) assert transaction_result is not None total_entities = 0 async for e in table.list_entities(): total_entities += 1 assert total_entities == transaction_count finally: await self._tear_down()
def test_batch_sas_auth(self, tables_storage_account_name, tables_primary_storage_account_key): set_bodiless_matcher() # Arrange self._set_up(tables_storage_account_name, tables_primary_storage_account_key) try: token = self.generate_sas( generate_table_sas, tables_primary_storage_account_key, self.table_name, permission=TableSasPermissions(add=True, read=True, update=True, delete=True), expiry=datetime.utcnow() + timedelta(hours=1), start=datetime.utcnow() - timedelta(minutes=1), ) token = AzureSasCredential(token) # Act service = TableServiceClient( self.account_url(tables_storage_account_name, "table"), credential=token, ) table = service.get_table_client(self.table_name) entity = TableEntity() entity['PartitionKey'] = 'batch_inserts' entity['test'] = EntityProperty(True, EdmType.BOOLEAN) entity['test2'] = 'value' entity['test3'] = 3 entity['test4'] = EntityProperty(1234567890, EdmType.INT32) batch = [] transaction_count = 0 for i in range(10): entity['RowKey'] = str(i) batch.append(('create', entity.copy())) transaction_count += 1 transaction_result = table.submit_transaction(batch) assert transaction_result total_entities = 0 for e in table.list_entities(): total_entities += 1 assert total_entities == transaction_count finally: self._tear_down()
def test_batch_reuse(self, tables_storage_account_name, tables_primary_storage_account_key): set_bodiless_matcher() # Arrange self._set_up(tables_storage_account_name, tables_primary_storage_account_key) try: table2_name = self._get_table_reference('table2') table2 = self.ts.get_table_client(table2_name) table2.create_table() # Act entity = TableEntity() entity['PartitionKey'] = '003' entity['RowKey'] = 'batch_all_operations_together-1' entity['test'] = EntityProperty(True, EdmType.BOOLEAN) entity['test2'] = 'value' entity['test3'] = 3 entity['test4'] = EntityProperty(1234567890, EdmType.INT32) entity['test5'] = datetime.utcnow() batch = [] batch.append(('upsert', entity.copy())) entity['RowKey'] = 'batch_all_operations_together-2' batch.append(('upsert', entity.copy())) entity['RowKey'] = 'batch_all_operations_together-3' batch.append(('upsert', entity.copy())) entity['RowKey'] = 'batch_all_operations_together-4' batch.append(('upsert', entity.copy())) resp1 = self.table.submit_transaction(batch) resp2 = table2.submit_transaction(batch) entities = list(self.table.query_entities("PartitionKey eq '003'")) assert 4 == len(entities) table2 = list(table2.query_entities("PartitionKey eq '003'")) assert 4 == len(entities) finally: self._tear_down()
async def test_batch_sas_auth(self, tables_storage_account_name, tables_primary_storage_account_key): # Arrange await self._set_up(tables_storage_account_name, tables_primary_storage_account_key) try: token = generate_table_sas( tables_storage_account_name, tables_primary_storage_account_key, self.table_name, permission=TableSasPermissions(add=True, read=True, update=True, delete=True), expiry=datetime.utcnow() + timedelta(hours=1), start=datetime.utcnow() - timedelta(minutes=1), ) token = AzureSasCredential(token) # Act service = TableServiceClient( self.account_url(tables_storage_account_name, "table"), credential=token, ) table = service.get_table_client(self.table_name) entity = TableEntity() entity.PartitionKey = 'batch_inserts' entity.test = EntityProperty(True) entity.test2 = 'value' entity.test3 = 3 entity.test4 = EntityProperty(1234567890) batch = [] transaction_count = 0 for i in range(10): entity.RowKey = str(i) batch.append(('create', entity.copy())) transaction_count += 1 transaction_result = await table.submit_transaction(batch) assert transaction_result is not None total_entities = 0 async for e in table.list_entities(): total_entities += 1 assert total_entities == transaction_count finally: await self._tear_down()
def test_batch_reuse(self, tables_storage_account_name, tables_primary_storage_account_key): # Arrange self._set_up(tables_storage_account_name, tables_primary_storage_account_key) try: table2 = self._get_table_reference('table2') table2.create_table() # Act entity = TableEntity() entity.PartitionKey = '003' entity.RowKey = 'batch_all_operations_together-1' entity.test = EntityProperty(True) entity.test2 = 'value' entity.test3 = 3 entity.test4 = EntityProperty(1234567890) entity.test5 = datetime.utcnow() batch = [] batch.append(('upsert', entity.copy())) entity.RowKey = 'batch_all_operations_together-2' batch.append(('upsert', entity.copy())) entity.RowKey = 'batch_all_operations_together-3' batch.append(('upsert', entity.copy())) entity.RowKey = 'batch_all_operations_together-4' batch.append(('upsert', entity.copy())) resp1 = self.table.submit_transaction(batch) resp2 = table2.submit_transaction(batch) entities = list(self.table.query_entities("PartitionKey eq '003'")) assert 4 == len(entities) table2 = list(table2.query_entities("PartitionKey eq '003'")) assert 4 == len(entities) finally: self._tear_down()
def test_batch_single_op_if_doesnt_match( self, tables_storage_account_name, tables_primary_storage_account_key): set_bodiless_matcher() # Arrange self._set_up(tables_storage_account_name, tables_primary_storage_account_key) try: # Act entity = TableEntity() entity['PartitionKey'] = 'batch_inserts' entity['test'] = EntityProperty(True, EdmType.BOOLEAN) entity['test2'] = 'value' entity['test3'] = 3 entity['test4'] = EntityProperty(1234567890, EdmType.INT32) batch = [] transaction_count = 0 for i in range(10): entity['RowKey'] = str(i) batch.append(('create', entity.copy())) transaction_count += 1 entity = self._create_random_entity_dict() self.table.create_entity(entity) # Act sent_entity1 = self._create_updated_entity_dict( entity['PartitionKey'], entity['RowKey']) batch = [('update', sent_entity1, { 'etag': u'W/"datetime\'2012-06-15T22%3A51%3A44.9662825Z\'"', 'match_condition': MatchConditions.IfNotModified })] with pytest.raises(TableTransactionError) as error: self.table.submit_transaction(batch) assert error.value.status_code == 412 assert error.value.error_code == TableErrorCode.update_condition_not_satisfied # Assert received_entity = self.table.get_entity(entity['PartitionKey'], entity['RowKey']) self._assert_default_entity(received_entity) finally: self._tear_down()
async def test_batch_inserts(self, tables_cosmos_account_name, tables_primary_cosmos_account_key): # this can be reverted to set_bodiless_matcher() after tests are re-recorded and don't contain these headers set_custom_default_matcher( compare_bodies=False, excluded_headers= "Authorization,Content-Length,x-ms-client-request-id,x-ms-request-id" ) # Arrange await self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key, url="cosmos") try: # Act entity = TableEntity() entity['PartitionKey'] = 'batch_inserts' entity['test'] = EntityProperty(True, EdmType.BOOLEAN) entity['test2'] = 'value' entity['test3'] = 3 entity['test4'] = EntityProperty(1234567890, EdmType.INT32) transaction_count = 0 batch = [] for i in range(10): entity['RowKey'] = str(i) batch.append(('create', entity.copy())) transaction_count += 1 transaction_result = await self.table.submit_transaction(batch) # Assert self._assert_valid_batch_transaction(transaction_result, transaction_count) assert 'etag' in transaction_result[0] entities = self.table.query_entities( "PartitionKey eq 'batch_inserts'") length = 0 async for e in entities: length += 1 # Assert assert entities is not None assert 10 == length finally: await self._tear_down()
def test_batch_single_op_if_doesnt_match( self, tables_storage_account_name, tables_primary_storage_account_key): # Arrange self._set_up(tables_storage_account_name, tables_primary_storage_account_key) try: # Act entity = TableEntity() entity.PartitionKey = 'batch_inserts' entity.test = EntityProperty(True) entity.test2 = 'value' entity.test3 = 3 entity.test4 = EntityProperty(1234567890) batch = [] transaction_count = 0 for i in range(10): entity.RowKey = str(i) batch.append(('create', entity.copy())) transaction_count += 1 entity = self._create_random_entity_dict() self.table.create_entity(entity) # Act sent_entity1 = self._create_updated_entity_dict( entity['PartitionKey'], entity['RowKey']) batch = [('update', sent_entity1, { 'etag': u'W/"datetime\'2012-06-15T22%3A51%3A44.9662825Z\'"', 'match_condition': MatchConditions.IfNotModified })] with pytest.raises(TableTransactionError): self.table.submit_transaction(batch) # Assert received_entity = self.table.get_entity(entity['PartitionKey'], entity['RowKey']) self._assert_default_entity(received_entity) finally: self._tear_down()
def test_batch_too_many_ops(self, tables_storage_account_name, tables_primary_storage_account_key): # Arrange self._set_up(tables_storage_account_name, tables_primary_storage_account_key) try: entity = self._create_random_entity_dict('001', 'batch_negative_1') self.table.create_entity(entity) # Act with pytest.raises(TableTransactionError): batch = [] for i in range(0, 101): entity = TableEntity() entity['PartitionKey'] = 'large' entity['RowKey'] = 'item{0}'.format(i) batch.append(('create', entity.copy())) self.table.submit_transaction(batch) # Assert finally: self._tear_down()
def test_batch_inserts(self, tables_storage_account_name, tables_primary_storage_account_key): # Arrange self._set_up(tables_storage_account_name, tables_primary_storage_account_key) try: # Act entity = TableEntity() entity.PartitionKey = 'batch_inserts' entity.test = EntityProperty(True) entity.test2 = 'value' entity.test3 = 3 entity.test4 = EntityProperty(1234567890) transaction_count = 0 batch = [] for i in range(100): entity.RowKey = str(i) batch.append(('create', entity.copy())) transaction_count += 1 transaction_result = self.table.submit_transaction(batch) # Assert self._assert_valid_batch_transaction(transaction_result, transaction_count) assert 'etag' in transaction_result[0] entities = list( self.table.query_entities("PartitionKey eq 'batch_inserts'")) # Assert assert entities is not None assert transaction_count == len(entities) e = self.table.get_entity('batch_inserts', '1') finally: self._tear_down()
async def test_batch_all_operations_together( self, tables_cosmos_account_name, tables_primary_cosmos_account_key): # Arrange await self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key) try: # Act entity = TableEntity() entity.PartitionKey = '003' entity.RowKey = 'batch_all_operations_together-1' entity.test = EntityProperty(True) entity.test2 = 'value' entity.test3 = 3 entity.test4 = EntityProperty(1234567890) entity.test5 = datetime.utcnow() await self.table.create_entity(entity) entity.RowKey = 'batch_all_operations_together-2' await self.table.create_entity(entity) entity.RowKey = 'batch_all_operations_together-3' await self.table.create_entity(entity) entity.RowKey = 'batch_all_operations_together-4' await self.table.create_entity(entity) transaction_count = 0 batch = [] entity.RowKey = 'batch_all_operations_together' batch.append((TransactionOperation.CREATE, entity.copy())) transaction_count += 1 entity.RowKey = 'batch_all_operations_together-1' batch.append((TransactionOperation.DELETE, entity.copy())) transaction_count += 1 entity.RowKey = 'batch_all_operations_together-2' entity.test3 = 10 batch.append((TransactionOperation.UPDATE, entity.copy())) transaction_count += 1 entity.RowKey = 'batch_all_operations_together-3' entity.test3 = 100 batch.append((TransactionOperation.UPDATE, entity.copy(), { 'mode': UpdateMode.REPLACE })) transaction_count += 1 entity.RowKey = 'batch_all_operations_together-4' entity.test3 = 10 batch.append((TransactionOperation.UPSERT, entity.copy())) transaction_count += 1 entity.RowKey = 'batch_all_operations_together-5' batch.append((TransactionOperation.UPSERT, entity.copy(), { 'mode': UpdateMode.REPLACE })) transaction_count += 1 transaction_result = await self.table.submit_transaction(batch) # Assert self._assert_valid_batch_transaction(transaction_result, transaction_count) assert 'etag' in transaction_result[0] assert 'etag' not in transaction_result[1] assert 'etag' in transaction_result[2] assert 'etag' in transaction_result[3] assert 'etag' in transaction_result[4] assert 'etag' in transaction_result[5] entities = self.table.query_entities("PartitionKey eq '003'") length = 0 async for e in entities: length += 1 assert 5 == length finally: await self._tear_down()
def test_batch_all_operations_together(self, tables_storage_account_name, tables_primary_storage_account_key): # Arrange self._set_up(tables_storage_account_name, tables_primary_storage_account_key) try: # Act entity = TableEntity() entity['PartitionKey'] = '003' entity['RowKey'] = 'batch_all_operations_together-1' entity['test'] = EntityProperty(True, EdmType.BOOLEAN) entity['test2'] = 'value' entity['test3'] = 3 entity['test4'] = EntityProperty(1234567890, EdmType.INT32) entity['test5'] = datetime.utcnow() self.table.create_entity(entity) entity['RowKey'] = 'batch_all_operations_together-2' self.table.create_entity(entity) entity['RowKey'] = 'batch_all_operations_together-3' self.table.create_entity(entity) entity['RowKey'] = 'batch_all_operations_together-4' self.table.create_entity(entity) transaction_count = 0 batch = [] entity['RowKey'] = 'batch_all_operations_together' batch.append((TransactionOperation.CREATE, entity.copy())) transaction_count += 1 entity['RowKey'] = 'batch_all_operations_together-1' batch.append((TransactionOperation.DELETE, entity.copy())) transaction_count += 1 entity['RowKey'] = 'batch_all_operations_together-2' entity['test3'] = 10 batch.append((TransactionOperation.UPDATE, entity.copy())) transaction_count += 1 entity['RowKey'] = 'batch_all_operations_together-3' entity['test3'] = 100 batch.append((TransactionOperation.UPDATE, entity.copy(), { 'mode': UpdateMode.REPLACE })) transaction_count += 1 entity['RowKey'] = 'batch_all_operations_together-4' entity['test3'] = 10 batch.append((TransactionOperation.UPSERT, entity.copy())) transaction_count += 1 entity['RowKey'] = 'batch_all_operations_together-5' batch.append((TransactionOperation.UPSERT, entity.copy(), { 'mode': UpdateMode.REPLACE })) transaction_count += 1 transaction_result = self.table.submit_transaction(batch) # Assert self._assert_valid_batch_transaction(transaction_result, transaction_count) assert 'etag' in transaction_result[0] assert 'etag' not in transaction_result[1] assert 'etag' in transaction_result[2] assert 'etag' in transaction_result[3] assert 'etag' in transaction_result[4] assert 'etag' in transaction_result[5] # Assert entities = list(self.table.query_entities("PartitionKey eq '003'")) assert 5 == len(entities) finally: self._tear_down()
async def test_aad_batch_all_operations_together( self, tables_storage_account_name): # this can be reverted to set_bodiless_matcher() after tests are re-recorded and don't contain these headers set_custom_default_matcher( compare_bodies=False, excluded_headers= "Authorization,Content-Length,x-ms-client-request-id,x-ms-request-id" ) await self._set_up(tables_storage_account_name, self.get_token_credential()) try: entity = TableEntity() entity["PartitionKey"] = "003" entity["RowKey"] = "batch_all_operations_together-1" entity["test"] = EntityProperty(True, EdmType.BOOLEAN) entity["test2"] = "value" entity["test3"] = 3 entity["test4"] = EntityProperty(1234567890, EdmType.INT32) entity["test5"] = datetime.utcnow() await self.table.create_entity(entity) entity["RowKey"] = "batch_all_operations_together-2" await self.table.create_entity(entity) entity["RowKey"] = "batch_all_operations_together-3" await self.table.create_entity(entity) entity["RowKey"] = "batch_all_operations_together-4" await self.table.create_entity(entity) transaction_count = 0 batch = [] entity["RowKey"] = "batch_all_operations_together" batch.append((TransactionOperation.CREATE, entity.copy())) transaction_count += 1 entity["RowKey"] = "batch_all_operations_together-1" batch.append((TransactionOperation.DELETE, entity.copy())) transaction_count += 1 entity["RowKey"] = "batch_all_operations_together-2" entity["test3"] = 10 batch.append((TransactionOperation.UPDATE, entity.copy())) transaction_count += 1 entity["RowKey"] = "batch_all_operations_together-3" entity["test3"] = 100 batch.append((TransactionOperation.UPDATE, entity.copy(), { "mode": UpdateMode.REPLACE })) transaction_count += 1 entity["RowKey"] = "batch_all_operations_together-4" entity["test3"] = 10 batch.append((TransactionOperation.UPSERT, entity.copy())) transaction_count += 1 entity["RowKey"] = "batch_all_operations_together-5" batch.append((TransactionOperation.UPSERT, entity.copy(), { "mode": UpdateMode.REPLACE })) transaction_count += 1 transaction_result = await self.table.submit_transaction(batch) self._assert_valid_batch_transaction(transaction_result, transaction_count) assert "etag" in transaction_result[0] assert "etag" not in transaction_result[1] assert "etag" in transaction_result[2] assert "etag" in transaction_result[3] assert "etag" in transaction_result[4] assert "etag" in transaction_result[5] entity_count = 0 async for e in self.table.query_entities("PartitionKey eq '003'"): entity_count += 1 assert 5 == entity_count finally: await self._tear_down()
def test_aad_batch_all_operations_together(self, tables_storage_account_name): set_bodiless_matcher() self._set_up(tables_storage_account_name, self.get_token_credential()) try: entity = TableEntity() entity["PartitionKey"] = "003" entity["RowKey"] = "batch_all_operations_together-1" entity["test"] = EntityProperty(True, EdmType.BOOLEAN) entity["test2"] = "value" entity["test3"] = 3 entity["test4"] = EntityProperty(1234567890, EdmType.INT32) entity["test5"] = datetime.utcnow() self.table.create_entity(entity) entity["RowKey"] = "batch_all_operations_together-2" self.table.create_entity(entity) entity["RowKey"] = "batch_all_operations_together-3" self.table.create_entity(entity) entity["RowKey"] = "batch_all_operations_together-4" self.table.create_entity(entity) transaction_count = 0 batch = [] entity["RowKey"] = "batch_all_operations_together" batch.append((TransactionOperation.CREATE, entity.copy())) transaction_count += 1 entity["RowKey"] = "batch_all_operations_together-1" batch.append((TransactionOperation.DELETE, entity.copy())) transaction_count += 1 entity["RowKey"] = "batch_all_operations_together-2" entity["test3"] = 10 batch.append((TransactionOperation.UPDATE, entity.copy())) transaction_count += 1 entity["RowKey"] = "batch_all_operations_together-3" entity["test3"] = 100 batch.append((TransactionOperation.UPDATE, entity.copy(), { "mode": UpdateMode.REPLACE })) transaction_count += 1 entity["RowKey"] = "batch_all_operations_together-4" entity["test3"] = 10 batch.append((TransactionOperation.UPSERT, entity.copy())) transaction_count += 1 entity["RowKey"] = "batch_all_operations_together-5" batch.append((TransactionOperation.UPSERT, entity.copy(), { "mode": UpdateMode.REPLACE })) transaction_count += 1 transaction_result = self.table.submit_transaction(batch) self._assert_valid_batch_transaction(transaction_result, transaction_count) assert "etag" in transaction_result[0] assert "etag" not in transaction_result[1] assert "etag" in transaction_result[2] assert "etag" in transaction_result[3] assert "etag" in transaction_result[4] assert "etag" in transaction_result[5] entities = list(self.table.query_entities("PartitionKey eq '003'")) assert 5 == len(entities) finally: self._tear_down()
async def test_batch_all_operations_together( self, tables_cosmos_account_name, tables_primary_cosmos_account_key): # this can be reverted to set_bodiless_matcher() after tests are re-recorded and don't contain these headers set_custom_default_matcher( compare_bodies=False, excluded_headers= "Authorization,Content-Length,x-ms-client-request-id,x-ms-request-id" ) # Arrange await self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key, url="cosmos") try: # Act entity = TableEntity() entity['PartitionKey'] = '003' entity['RowKey'] = 'batch_all_operations_together-1' entity['test'] = EntityProperty(True, EdmType.BOOLEAN) entity['test2'] = 'value' entity['test3'] = 3 entity['test4'] = EntityProperty(1234567890, EdmType.INT32) entity['test5'] = datetime.utcnow() await self.table.create_entity(entity) entity['RowKey'] = 'batch_all_operations_together-2' await self.table.create_entity(entity) entity['RowKey'] = 'batch_all_operations_together-3' await self.table.create_entity(entity) entity['RowKey'] = 'batch_all_operations_together-4' await self.table.create_entity(entity) transaction_count = 0 batch = [] entity['RowKey'] = 'batch_all_operations_together' batch.append((TransactionOperation.CREATE, entity.copy())) transaction_count += 1 entity['RowKey'] = 'batch_all_operations_together-1' batch.append((TransactionOperation.DELETE, entity.copy())) transaction_count += 1 entity['RowKey'] = 'batch_all_operations_together-2' entity['test3'] = 10 batch.append((TransactionOperation.UPDATE, entity.copy())) transaction_count += 1 entity['RowKey'] = 'batch_all_operations_together-3' entity['test3'] = 100 batch.append((TransactionOperation.UPDATE, entity.copy(), { 'mode': UpdateMode.REPLACE })) transaction_count += 1 entity['RowKey'] = 'batch_all_operations_together-4' entity['test3'] = 10 batch.append((TransactionOperation.UPSERT, entity.copy())) transaction_count += 1 entity['RowKey'] = 'batch_all_operations_together-5' batch.append((TransactionOperation.UPSERT, entity.copy(), { 'mode': UpdateMode.REPLACE })) transaction_count += 1 transaction_result = await self.table.submit_transaction(batch) # Assert self._assert_valid_batch_transaction(transaction_result, transaction_count) assert 'etag' in transaction_result[0] assert 'etag' not in transaction_result[1] assert 'etag' in transaction_result[2] assert 'etag' in transaction_result[3] assert 'etag' in transaction_result[4] assert 'etag' in transaction_result[5] entities = self.table.query_entities("PartitionKey eq '003'") length = 0 async for e in entities: length += 1 assert 5 == length finally: await self._tear_down()