Skip to content

Commit

Permalink
test fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
Ashutosh619-sudo committed Oct 15, 2024
1 parent f5f119c commit c9e8b95
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 0 deletions.
1 change: 1 addition & 0 deletions apps/business_central/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
'locations': 1000
}


class BusinessCentralConnector:
"""
Business Central Utility Functions
Expand Down
4 changes: 4 additions & 0 deletions tests/test_mappings/test_imports/test_modules/test_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ def test_sync_destination_attributes(
"dynamics.apis.Accounts.get_all",
return_value=destination_attributes_data["get_account_destination_attributes"],
)
mocker.patch(
"dynamics.apis.Accounts.count",
return_value=5,
)

account_count = DestinationAttribute.objects.filter(
workspace_id=workspace_id, attribute_type="ACCOUNT"
Expand Down
12 changes: 12 additions & 0 deletions tests/test_mappings/test_imports/test_modules/test_categories.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ def test_sync_destination_attributes_categories(
"dynamics.apis.Accounts.get_all",
return_value=destination_attributes_data["get_account_destination_attributes"],
)
mocker.patch(
"dynamics.apis.Accounts.count",
return_value=5,
)

account_count = DestinationAttribute.objects.filter(
workspace_id=workspace_id, attribute_type="ACCOUNT"
Expand All @@ -36,6 +40,10 @@ def test_sync_destination_attributes_categories(
).count()
assert new_account_count == 2

mocker.patch(
"dynamics.apis.Locations.count",
return_value=5
)
mocker.patch(
"dynamics.apis.Locations.get_all",
return_value=destination_attributes_data[
Expand Down Expand Up @@ -132,6 +140,10 @@ def test_auto_create_destination_attributes(
"fyle_integrations_platform_connector.apis.Categories.post_bulk",
return_value=[],
)
mocker.patch(
"dynamics.apis.Accounts.count",
return_value=5
)
mocker.patch(
"dynamics.apis.Accounts.get_all",
return_value=destination_attributes_data[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,10 @@ def test_auto_create_destination_attributes(
"fyle_integrations_platform_connector.apis.CostCenters.post_bulk",
return_value=[],
)
mocker.patch(
"dynamics.apis.Locations.count",
return_value=5,
)
mocker.patch(
"dynamics.apis.Locations.get_all",
return_value=data["get_location_destination_attributes_0"],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,10 @@ def test_auto_create_destination_attributes(
"fyle_integrations_platform_connector.apis.ExpenseCustomFields.post",
return_value=[],
)
mocker.patch(
"dynamics.apis.Locations.count",
return_value=5,
)
mocker.patch(
"dynamics.apis.Locations.get_all",
return_value=data["get_location_destination_attributes_2"],
Expand Down Expand Up @@ -139,6 +143,10 @@ def test_auto_create_destination_attributes(
"fyle_integrations_platform_connector.apis.ExpenseCustomFields.get_by_id",
return_value=data["create_new_auto_create_expense_custom_fields_get_by_id"],
)
mocker.patch(
"dynamics.apis.Locations.count",
return_value=5,
)
mocker.patch(
"dynamics.apis.Locations.get_all",
return_value=data["get_location_destination_attributes_3"],
Expand Down
12 changes: 12 additions & 0 deletions tests/test_mappings/test_imports/test_modules/test_merchants.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ def test_sync_destination_atrributes(
add_business_central_creds,
mocker,
):
mocker.patch(
"dynamics.apis.Vendors.count",
return_value=5,
)
mocker.patch(
"dynamics.apis.Vendors.get_all",
return_value=data["get_vendors_destination_attributes"],
Expand Down Expand Up @@ -107,6 +111,10 @@ def test_auto_create_destination_attributes(
mocker.patch(
"fyle_integrations_platform_connector.apis.Merchants.post", return_value=[]
)
mocker.patch(
"dynamics.apis.Vendors.count",
return_value=5,
)
mocker.patch(
"dynamics.apis.Vendors.get_all",
return_value=data["get_vendors_destination_attributes"],
Expand Down Expand Up @@ -151,6 +159,10 @@ def test_auto_create_destination_attributes(
mocker.patch(
"fyle_integrations_platform_connector.apis.Merchants.post", return_value=[]
)
mocker.patch(
"dynamics.apis.Vendors.count",
return_value=5,
)
mocker.patch(
"dynamics.apis.Vendors.get_all",
return_value=data["get_vendors_destination_attributes_subsequent_run"],
Expand Down

0 comments on commit c9e8b95

Please sign in to comment.