-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
labhvam5
committed
Nov 20, 2023
1 parent
d4327f7
commit 3cbb8c2
Showing
4 changed files
with
54 additions
and
1 deletion.
There are no files selected for viewing
26 changes: 26 additions & 0 deletions
26
tests/test_fyle_integrations_imports/test_modules/fixtures.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
projects_data = { | ||
"get_projects_destination_attributes_customers": [ | ||
{ | ||
"FullyQualifiedName": "France", | ||
"domain": "QBO", | ||
"Name": "France", | ||
"SyncToken": "0", | ||
"SubClass": False, | ||
"sparse": False, | ||
"Active": True, | ||
"Id": "5000000000000007280", | ||
"MetaData": {"CreateTime": "2015-07-22T13:57:27-07:00", "LastUpdatedTime": "2015-07-22T13:57:27-07:00"}, | ||
}, | ||
{ | ||
"FullyQualifiedName": "France", | ||
"domain": "QBO", | ||
"Name": "France", | ||
"SyncToken": "0", | ||
"SubClass": False, | ||
"sparse": False, | ||
"Active": True, | ||
"Id": "9", | ||
"MetaData": {"CreateTime": "2015-07-22T13:57:27-07:00", "LastUpdatedTime": "2015-07-22T13:57:27-07:00"}, | ||
}, | ||
], | ||
} |
27 changes: 27 additions & 0 deletions
27
tests/test_fyle_integrations_imports/test_modules/test_projects.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
from fyle_accounting_mappings.models import ( | ||
DestinationAttribute, | ||
ExpenseAttribute, | ||
Mapping, | ||
) | ||
from apps.quickbooks_online.utils import QBOConnector | ||
from apps.workspaces.models import QBOCredential | ||
from fyle_integrations_imports.modules import Project | ||
from tests.test_fyle_integrations_imports.test_modules.fixtures import projects_data | ||
|
||
def test_sync_destination_attributes(mocker, db): | ||
workspace_id = 3 | ||
|
||
mocker.patch('qbosdk.apis.Customers.count', return_value=5) | ||
mocker.patch('qbosdk.apis.Customers.get', return_value=projects_data['get_projects_destination_attributes_customers']) | ||
|
||
qbo_credentials = QBOCredential.get_active_qbo_credentials(workspace_id) | ||
qbo_connection = QBOConnector(credentials_object=qbo_credentials, workspace_id=workspace_id) | ||
|
||
destination_attributes_count = DestinationAttribute.objects.filter(workspace_id=3, attribute_type='CUSTOMER').count() | ||
assert destination_attributes_count == 29 | ||
|
||
project = Project(3, 'CUSTOMER', None, qbo_connection, 'customers', True) | ||
project.sync_destination_attributes() | ||
|
||
destination_attributes_count = DestinationAttribute.objects.filter(workspace_id=3, attribute_type='CUSTOMER').count() | ||
assert destination_attributes_count == 30 |
Empty file.