Skip to content

Commit

Permalink
Add tests for new addition
Browse files Browse the repository at this point in the history
  • Loading branch information
ashwin1111 committed Oct 12, 2023
1 parent 6861e98 commit 89f6600
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 2 deletions.
7 changes: 7 additions & 0 deletions tests/test_fyle/test_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
get_cluster_domain,
get_request,
post_request,
get_source_account_type
)
from apps.fyle.models import ExpenseFilter, Expense
from apps.fyle.helpers import get_updated_accounting_export_summary
Expand Down Expand Up @@ -405,3 +406,9 @@ def test_bulk_update_expenses(db):
settings.QBO_INTEGRATION_APP_URL
)
assert expense.accounting_export_summary['id'] == expense.expense_id


def test_get_source_account_type():
source_account = get_source_account_type(['PERSONAL', 'CCC'])

assert source_account == ['PERSONAL_CASH_ACCOUNT', 'PERSONAL_CORPORATE_CREDIT_CARD_ACCOUNT']
14 changes: 13 additions & 1 deletion tests/test_fyle/test_queue.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from apps.fyle.models import Expense
from apps.fyle.queue import async_post_accounting_export_summary
from apps.fyle.queue import async_post_accounting_export_summary, async_import_and_export_expenses
from apps.quickbooks_online.queue import __create_chain_and_run
from apps.workspaces.models import FyleCredential

Expand All @@ -26,3 +26,15 @@ def test_create_chain_and_run(db):

__create_chain_and_run(fyle_credentials, in_progress_expenses, workspace_id, chain_tasks)
assert True

# This test is just for cov :D
def test_async_import_and_export_expenses(db):
body = {
'action': 'ACCOUNTING_EXPORT_INITIATED',
'data': {
'id': 'rp1s1L3QtMpF',
'org_id': 'or79Cob97KSh'
}
}

async_import_and_export_expenses(body)
6 changes: 5 additions & 1 deletion tests/test_fyle/test_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import pytest

from apps.fyle.models import Expense, ExpenseGroup, ExpenseGroupSettings
from apps.fyle.tasks import create_expense_groups, post_accounting_export_summary
from apps.fyle.tasks import create_expense_groups, post_accounting_export_summary, import_and_export_expenses
from apps.fyle.actions import mark_expenses_as_skipped
from apps.tasks.models import TaskLog
from apps.workspaces.models import FyleCredential, Workspace
Expand Down Expand Up @@ -102,3 +102,7 @@ def test_post_accounting_export_summary(db, mocker):
post_accounting_export_summary('or79Cob97KSh', 3)

assert Expense.objects.filter(id=expense_id).first().accounting_export_summary['synced'] == True


def test_import_and_export_expenses(db):
import_and_export_expenses('rp1s1L3QtMpF', 'or79Cob97KSh')

0 comments on commit 89f6600

Please sign in to comment.