Skip to content

Commit

Permalink
test: update tests to account for the new function signature
Browse files Browse the repository at this point in the history
  • Loading branch information
JustARatherRidiculouslyLongUsername committed Nov 21, 2024
1 parent 208c3d5 commit ac6b250
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 13 deletions.
2 changes: 1 addition & 1 deletion apps/netsuite/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -678,7 +678,7 @@ class Meta:
db_table = 'credit_card_charge_lineitems'

@staticmethod
def create_credit_card_charge_lineitem(expense_group: ExpenseGroup, configuration: Configuration):
def create_credit_card_charge_lineitems(expense_group: ExpenseGroup, configuration: Configuration):
"""
Create credit card charge lineitems
:param expense_group: expense group
Expand Down
2 changes: 1 addition & 1 deletion apps/netsuite/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,7 @@ def create_credit_card_charge(expense_group, task_log_id, last_export):
with transaction.atomic():
credit_card_charge_object = CreditCardCharge.create_credit_card_charge(expense_group)

credit_card_charge_lineitems_objects = CreditCardChargeLineItem.create_credit_card_charge_lineitem(
credit_card_charge_lineitems_objects = CreditCardChargeLineItem.create_credit_card_charge_lineitems(
expense_group, configuration
)
attachment_links = {}
Expand Down
2 changes: 1 addition & 1 deletion tests/test_netsuite/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ def create_credit_card_charge(db, add_netsuite_credentials, add_fyle_credentials
configuration = Configuration.objects.get(workspace_id=1)
credit_card_charge_object = CreditCardCharge.create_credit_card_charge(expense_group)

credit_card_charge_lineitems_object = CreditCardChargeLineItem.create_credit_card_charge_lineitem(
credit_card_charge_lineitems_object = CreditCardChargeLineItem.create_credit_card_charge_lineitems(
expense_group, configuration
)

Expand Down
4 changes: 2 additions & 2 deletions tests/test_netsuite/test_connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,8 @@ def test_contruct_credit_card_charge(create_credit_card_charge):
netsuite_connection = NetSuiteConnector(netsuite_credentials=netsuite_credentials, workspace_id=49)


credit_card_charge, credit_card_charge_lineitem = create_credit_card_charge
credit_card_charge_object = netsuite_connection._NetSuiteConnector__construct_credit_card_charge(credit_card_charge, credit_card_charge_lineitem, [])
credit_card_charge, credit_card_charge_lineitems = create_credit_card_charge
credit_card_charge_object = netsuite_connection._NetSuiteConnector__construct_credit_card_charge(credit_card_charge, credit_card_charge_lineitems, [])

credit_card_charge_object['tranDate'] = data['credit_card_charge'][0]['tranDate']
credit_card_charge_object['tranid'] = data['credit_card_charge'][0]['tranid']
Expand Down
18 changes: 10 additions & 8 deletions tests/test_netsuite/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -340,11 +340,12 @@ def test_create_credit_card_charge(db):
expense_group = ExpenseGroup.objects.get(id=4)
credit_card = CreditCardCharge.create_credit_card_charge(expense_group)
configuration = Configuration.objects.get(workspace_id=2)
credit_card_charge_lineitem = CreditCardChargeLineItem.create_credit_card_charge_lineitem(expense_group, configuration)
credit_card_charge_lineitems = CreditCardChargeLineItem.create_credit_card_charge_lineitems(expense_group, configuration)

assert credit_card_charge_lineitem.amount == 100.00
assert credit_card_charge_lineitem.memo == '[email protected] - Accounts Payable - 2021-11-16 - C/2021/11/R/1 - '
assert credit_card_charge_lineitem.billable == False
line = credit_card_charge_lineitems[0]
assert line.amount == 100.00
assert line.memo == '[email protected] - Accounts Payable - 2021-11-16 - C/2021/11/R/1 - '
assert line.billable == False

assert credit_card.currency == '1'
assert credit_card.transaction_date <= datetime.now().strftime('%Y-%m-%dT%H:%M:%S')
Expand All @@ -363,11 +364,12 @@ def test_create_credit_card_charge(db):

credit_card = CreditCardCharge.create_credit_card_charge(expense_group)
configuration = Configuration.objects.get(workspace_id=1)
credit_card_charge_lineitem = CreditCardChargeLineItem.create_credit_card_charge_lineitem(expense_group, configuration)
credit_card_charge_lineitems = CreditCardChargeLineItem.create_credit_card_charge_lineitems(expense_group, configuration)

assert credit_card_charge_lineitem.amount == 100.00
assert credit_card_charge_lineitem.memo == '[email protected] - Accounts Payable - 2021-11-15 - C/2021/11/R/6 - '
assert credit_card_charge_lineitem.billable == False
line = credit_card_charge_lineitems[0]
assert line.amount == 100.00
assert line.memo == '[email protected] - Accounts Payable - 2021-11-15 - C/2021/11/R/6 - '
assert line.billable == False

assert credit_card.currency == '1'
assert credit_card.transaction_date <= datetime.now().strftime('%Y-%m-%dT%H:%M:%S')
Expand Down

0 comments on commit ac6b250

Please sign in to comment.