Skip to content

Commit

Permalink
Revert fixed changes
Browse files Browse the repository at this point in the history
  • Loading branch information
prijendev authored Dec 12, 2024
1 parent 9b56a81 commit d724866
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 33 deletions.
17 changes: 9 additions & 8 deletions tests/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,22 +43,23 @@ class TestSquareBase(ABC, TestCase):
START_DATE = ""
PRODUCTION_ONLY_STREAMS = {'bank_accounts', 'payouts'}

DEFAULT_BATCH_LIMIT = 10
DEFAULT_BATCH_LIMIT = 1000
API_LIMIT = {
'items': DEFAULT_BATCH_LIMIT,
'inventories': DEFAULT_BATCH_LIMIT,
'inventories': 100,
'categories': DEFAULT_BATCH_LIMIT,
'discounts': DEFAULT_BATCH_LIMIT,
'taxes': DEFAULT_BATCH_LIMIT,
'cash_drawer_shifts': DEFAULT_BATCH_LIMIT,
'locations': None, # Api does not accept a cursor and documents no limit, see https://developer.squareup.com/reference/square/locations/list-locations
'refunds': DEFAULT_BATCH_LIMIT,
'payments': DEFAULT_BATCH_LIMIT,
'payouts': DEFAULT_BATCH_LIMIT,
'customers': DEFAULT_BATCH_LIMIT,
'roles': 100,
'refunds': 100,
'payments': 100,
'payouts': 100,
'customers': 100,
'modifier_lists': DEFAULT_BATCH_LIMIT,
'orders': DEFAULT_BATCH_LIMIT,
'shifts': DEFAULT_BATCH_LIMIT,
'orders': 500,
'shifts': 200,
}

def setUp(self):
Expand Down
6 changes: 2 additions & 4 deletions tests/test_all_fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,14 +96,12 @@ def test_run(self):
"""Instantiate start date according to the desired data set and run the test"""
print("\n\nTESTING WITH DYNAMIC DATA IN SQUARE_ENVIRONMENT: {}".format(os.getenv('TAP_SQUARE_ENVIRONMENT')))
self.START_DATE = self.get_properties().get('start_date')
# Not testing few of the streams
streams_not_testing = {'locations', 'customers', 'taxes', 'items', 'modifier_lists', 'orders'}
self.TESTABLE_STREAMS = self.testable_streams_dynamic().difference(self.production_streams()).difference(streams_not_testing)
self.TESTABLE_STREAMS = self.testable_streams_dynamic().difference(self.production_streams())
self.all_fields_test(self.SANDBOX, DataType.DYNAMIC)

print("\n\nTESTING WITH STATIC DATA IN SQUARE_ENVIRONMENT: {}".format(os.getenv('TAP_SQUARE_ENVIRONMENT')))
self.START_DATE = self.STATIC_START_DATE
self.TESTABLE_STREAMS = self.testable_streams_static().difference(self.production_streams()).difference(streams_not_testing)
self.TESTABLE_STREAMS = self.testable_streams_static().difference(self.production_streams())
self.all_fields_test(self.SANDBOX, DataType.STATIC)

self.set_environment(self.PRODUCTION)
Expand Down
11 changes: 5 additions & 6 deletions tests/test_automatic_fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,12 @@ def test_run(self):
self.TESTABLE_STREAMS = self.testable_streams_static().difference(self.production_streams()) - {'customers', 'team_members'}
self.auto_fields_test(self.SANDBOX, DataType.STATIC)

# Commenting to avoid Rate limit error
# self.set_environment(self.PRODUCTION)
self.set_environment(self.PRODUCTION)

# print("\n\nTESTING WITH DYNAMIC DATA IN SQUARE_ENVIRONMENT: {}".format(os.getenv('TAP_SQUARE_ENVIRONMENT')))
# self.START_DATE = self.get_properties().get('start_date')
# self.TESTABLE_STREAMS = self.testable_streams_dynamic().difference(self.sandbox_streams())
# self.auto_fields_test(self.PRODUCTION, DataType.DYNAMIC)
print("\n\nTESTING WITH DYNAMIC DATA IN SQUARE_ENVIRONMENT: {}".format(os.getenv('TAP_SQUARE_ENVIRONMENT')))
self.START_DATE = self.get_properties().get('start_date')
self.TESTABLE_STREAMS = self.testable_streams_dynamic().difference(self.sandbox_streams())
self.auto_fields_test(self.PRODUCTION, DataType.DYNAMIC)

def auto_fields_test(self, environment, data_type):
"""
Expand Down
10 changes: 5 additions & 5 deletions tests/test_bookmarks.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,12 @@ def test_run(self):
print("\n\nTESTING WITH DYNAMIC DATA IN SQUARE_ENVIRONMENT: {}".format(os.getenv('TAP_SQUARE_ENVIRONMENT')))
self.bookmarks_test(self.testable_streams_dynamic().intersection(self.sandbox_streams()))

# self.set_environment(self.PRODUCTION)
# production_testable_streams = self.testable_streams_dynamic().intersection(self.production_streams())
self.set_environment(self.PRODUCTION)
production_testable_streams = self.testable_streams_dynamic().intersection(self.production_streams())

# if production_testable_streams:
# print("\n\nTESTING WITH DYNAMIC DATA IN SQUARE_ENVIRONMENT: {}".format(os.getenv('TAP_SQUARE_ENVIRONMENT')))
# self.bookmarks_test(production_testable_streams)
if production_testable_streams:
print("\n\nTESTING WITH DYNAMIC DATA IN SQUARE_ENVIRONMENT: {}".format(os.getenv('TAP_SQUARE_ENVIRONMENT')))
self.bookmarks_test(production_testable_streams)

def bookmarks_test(self, testable_streams):
"""
Expand Down
2 changes: 1 addition & 1 deletion tests/test_bookmarks_cursor.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def testable_streams_dynamic(self):
# Shifts have cursor bookmarks because the api doesn't
# support incremental queries, but we fake it being
# incremental
# all_testable_streams.add('shifts')
all_testable_streams.add('shifts')

return all_testable_streams

Expand Down
17 changes: 8 additions & 9 deletions tests/test_start_date.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,14 @@ def test_run(self):
msg="Testable streams exist for this category.")
print("\tThere are no testable streams.")

# Commenting to avoid Rate limit error
# self.set_environment(self.PRODUCTION)

# print("\n\nTESTING WITH DYNAMIC DATA IN SQUARE_ENVIRONMENT: {}".format(os.getenv('TAP_SQUARE_ENVIRONMENT')))
# self.START_DATE = self.get_properties().get('start_date')
# self.START_DATE_1 = self.START_DATE
# self.START_DATE_2 = dt.strftime(dt.utcnow(), self.START_DATE_FORMAT)
# self.TESTABLE_STREAMS = self.testable_streams_dynamic().difference(self.sandbox_streams())
# self.start_date_test(self.get_environment(), DataType.DYNAMIC)
self.set_environment(self.PRODUCTION)

print("\n\nTESTING WITH DYNAMIC DATA IN SQUARE_ENVIRONMENT: {}".format(os.getenv('TAP_SQUARE_ENVIRONMENT')))
self.START_DATE = self.get_properties().get('start_date')
self.START_DATE_1 = self.START_DATE
self.START_DATE_2 = dt.strftime(dt.utcnow(), self.START_DATE_FORMAT)
self.TESTABLE_STREAMS = self.testable_streams_dynamic().difference(self.sandbox_streams())
self.start_date_test(self.get_environment(), DataType.DYNAMIC)

def start_date_test(self, environment, data_type):
print("\n\nRUNNING {}".format(self.name()))
Expand Down

0 comments on commit d724866

Please sign in to comment.