Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
calling all methods _set_up
  • Loading branch information
seankane-msft committed May 12, 2021
commit da85b22bf97caaa42e946c08fe9f4d8fc1a37f3d
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ async def _insert_random_entity(self, pk=None, rk=None):
metadata = await self.table.create_entity(entity=entity)
return entity, metadata["etag"]

async def set_up_entity_test(self, account_name, account_key, url="table"):
async def _set_up(self, account_name, account_key, url="table"):
account_url = self.account_url(account_name, url)
self.ts = TableServiceClient(account_url, account_key)
self.table_name = self.get_resource_name("uttable")
Expand Down
2 changes: 1 addition & 1 deletion sdk/tables/azure-data-tables/tests/_shared/testcase.py
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ def _insert_random_entity(self, pk=None, rk=None):
metadata = self.table.create_entity(entity)
return entity, metadata["etag"]

def set_up_entity_test(self, account_name, account_key, url="table"):
def _set_up(self, account_name, account_key, url="table"):
self.table_name = self.get_resource_name("uttable")
self.ts = TableServiceClient(
self.account_url(account_name, url), credential=account_key, table_name=self.table_name
Expand Down
44 changes: 22 additions & 22 deletions sdk/tables/azure-data-tables/tests/test_table_batch.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class StorageTableBatchTest(AzureTestCase, TableTestCase):
@tables_decorator
def test_batch_single_insert(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
self.set_up_entity_test(tables_storage_account_name, tables_primary_storage_account_key)
self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
try:
# Act
entity = TableEntity()
Expand Down Expand Up @@ -81,7 +81,7 @@ def test_batch_single_insert(self, tables_storage_account_name, tables_primary_s
@tables_decorator
def test_batch_single_update(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
self.set_up_entity_test(tables_storage_account_name, tables_primary_storage_account_key)
self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
try:
# Act
entity = TableEntity()
Expand Down Expand Up @@ -116,7 +116,7 @@ def test_batch_single_update(self, tables_storage_account_name, tables_primary_s
@tables_decorator
def test_batch_update(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
self.set_up_entity_test(tables_storage_account_name, tables_primary_storage_account_key)
self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
try:
# Act
entity = TableEntity()
Expand Down Expand Up @@ -153,7 +153,7 @@ def test_batch_update(self, tables_storage_account_name, tables_primary_storage_
@tables_decorator
def test_batch_merge(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
self.set_up_entity_test(tables_storage_account_name, tables_primary_storage_account_key)
self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
try:
# Act
entity = TableEntity()
Expand Down Expand Up @@ -192,7 +192,7 @@ def test_batch_merge(self, tables_storage_account_name, tables_primary_storage_a
@tables_decorator
def test_batch_update_if_match(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
self.set_up_entity_test(tables_storage_account_name, tables_primary_storage_account_key)
self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
try:
entity = self._create_random_entity_dict()
resp = self.table.create_entity(entity=entity)
Expand Down Expand Up @@ -220,7 +220,7 @@ def test_batch_update_if_match(self, tables_storage_account_name, tables_primary
@tables_decorator
def test_batch_update_if_doesnt_match(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
self.set_up_entity_test(tables_storage_account_name, tables_primary_storage_account_key)
self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
try:
entity = self._create_random_entity_dict()
self.table.create_entity(entity)
Expand All @@ -246,7 +246,7 @@ def test_batch_update_if_doesnt_match(self, tables_storage_account_name, tables_
@tables_decorator
def test_batch_single_op_if_doesnt_match(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
self.set_up_entity_test(tables_storage_account_name, tables_primary_storage_account_key)
self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
try:
# Act
entity = TableEntity()
Expand Down Expand Up @@ -288,7 +288,7 @@ def test_batch_single_op_if_doesnt_match(self, tables_storage_account_name, tabl
@tables_decorator
def test_batch_insert_replace(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
self.set_up_entity_test(tables_storage_account_name, tables_primary_storage_account_key)
self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
try:
# Act
entity = TableEntity()
Expand Down Expand Up @@ -318,7 +318,7 @@ def test_batch_insert_replace(self, tables_storage_account_name, tables_primary_
@tables_decorator
def test_batch_insert_merge(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
self.set_up_entity_test(tables_storage_account_name, tables_primary_storage_account_key)
self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
try:
# Act
entity = TableEntity()
Expand Down Expand Up @@ -348,7 +348,7 @@ def test_batch_insert_merge(self, tables_storage_account_name, tables_primary_st
@tables_decorator
def test_batch_delete(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
self.set_up_entity_test(tables_storage_account_name, tables_primary_storage_account_key)
self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
try:
# Act
entity = TableEntity()
Expand Down Expand Up @@ -380,7 +380,7 @@ def test_batch_delete(self, tables_storage_account_name, tables_primary_storage_
@tables_decorator
def test_batch_inserts(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
self.set_up_entity_test(tables_storage_account_name, tables_primary_storage_account_key)
self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
try:
# Act
entity = TableEntity()
Expand Down Expand Up @@ -415,7 +415,7 @@ def test_batch_inserts(self, tables_storage_account_name, tables_primary_storage
@tables_decorator
def test_batch_all_operations_together(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
self.set_up_entity_test(tables_storage_account_name, tables_primary_storage_account_key)
self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
try:
# Act
entity = TableEntity()
Expand Down Expand Up @@ -485,7 +485,7 @@ def test_batch_all_operations_together(self, tables_storage_account_name, tables
@tables_decorator
def test_batch_reuse(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
self.set_up_entity_test(tables_storage_account_name, tables_primary_storage_account_key)
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)
Expand Down Expand Up @@ -524,7 +524,7 @@ def test_batch_reuse(self, tables_storage_account_name, tables_primary_storage_a
@tables_decorator
def test_batch_same_row_operations_fail(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
self.set_up_entity_test(tables_storage_account_name, tables_primary_storage_account_key)
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)
Expand Down Expand Up @@ -552,7 +552,7 @@ def test_batch_same_row_operations_fail(self, tables_storage_account_name, table
@tables_decorator
def test_batch_different_partition_operations_fail(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
self.set_up_entity_test(tables_storage_account_name, tables_primary_storage_account_key)
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)
Expand All @@ -577,7 +577,7 @@ def test_batch_different_partition_operations_fail(self, tables_storage_account_
@tables_decorator
def test_batch_too_many_ops(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
self.set_up_entity_test(tables_storage_account_name, tables_primary_storage_account_key)
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)
Expand All @@ -600,7 +600,7 @@ def test_batch_too_many_ops(self, tables_storage_account_name, tables_primary_st
@tables_decorator
def test_batch_different_partition_keys(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
self.set_up_entity_test(tables_storage_account_name, tables_primary_storage_account_key)
self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
try:
entity = self._create_random_entity_dict('001', 'batch_negative_1')
entity2 = self._create_random_entity_dict('002', 'batch_negative_1')
Expand All @@ -617,7 +617,7 @@ def test_batch_different_partition_keys(self, tables_storage_account_name, table
@tables_decorator
def test_new_non_existent_table(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
self.set_up_entity_test(tables_storage_account_name, tables_primary_storage_account_key)
self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
try:
entity = self._create_random_entity_dict('001', 'batch_negative_1')

Expand Down Expand Up @@ -652,7 +652,7 @@ def test_new_invalid_key(self, tables_storage_account_name, tables_primary_stora
@tables_decorator
def test_new_delete_nonexistent_entity(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
self.set_up_entity_test(tables_storage_account_name, tables_primary_storage_account_key)
self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
try:
entity = self._create_random_entity_dict('001', 'batch_negative_1')

Expand All @@ -668,7 +668,7 @@ def test_new_delete_nonexistent_entity(self, tables_storage_account_name, tables
@tables_decorator
def test_delete_batch_with_bad_kwarg(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
self.set_up_entity_test(tables_storage_account_name, tables_primary_storage_account_key)
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)
Expand All @@ -695,7 +695,7 @@ def test_delete_batch_with_bad_kwarg(self, tables_storage_account_name, tables_p
@tables_decorator
def test_batch_sas_auth(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
self.set_up_entity_test(tables_storage_account_name, tables_primary_storage_account_key)
self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
try:

token = generate_table_sas(
Expand Down Expand Up @@ -744,7 +744,7 @@ def test_batch_sas_auth(self, tables_storage_account_name, tables_primary_storag
@tables_decorator
def test_batch_request_too_large(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
self.set_up_entity_test(tables_storage_account_name, tables_primary_storage_account_key)
self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
try:

batch = []
Expand Down
Loading