From 2456e405439b4e2c57e50fe220c41ae50c51c272 Mon Sep 17 00:00:00 2001 From: Viswas Date: Wed, 20 Nov 2024 14:31:47 +0530 Subject: [PATCH] test: fix failing tests --- tests/test_fyle/conftest.py | 2 +- tests/test_fyle/test_models.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/test_fyle/conftest.py b/tests/test_fyle/conftest.py index 04bc6c8e..cc753e66 100644 --- a/tests/test_fyle/conftest.py +++ b/tests/test_fyle/conftest.py @@ -31,7 +31,7 @@ def create_temp_workspace(db): @pytest.fixture def update_config_for_split_expense_grouping(db): def _update_config_for_split_expense_grouping(general_settings, expense_group_settings): - general_settings.corporate_credit_card_expenses_object = 'BANK TRANSACTION' + general_settings.corporate_credit_card_expenses_object = 'CREDIT CARD CHARGE' general_settings.save() expense_group_settings.split_expense_grouping = 'SINGLE_LINE_ITEM' expense_group_settings.corporate_credit_card_expense_group_fields = [ diff --git a/tests/test_fyle/test_models.py b/tests/test_fyle/test_models.py index 5a7ac07e..da453493 100644 --- a/tests/test_fyle/test_models.py +++ b/tests/test_fyle/test_models.py @@ -163,7 +163,7 @@ def test_split_expense_grouping_with_no_bank_transaction_id(db, update_config_fo expense_group_settings.save() ExpenseGroup.create_expense_groups_by_report_id_fund_source(expense_objects, configuration, workspace_id) - groups = ExpenseGroup.objects.filter(expenses__expense_id__in=[expense['id'] for expense in expenses]) + groups = ExpenseGroup.objects.filter(expenses__expense_id__in=[expense['id'] for expense in expenses]).distinct() assert len(groups) - old_count == 2, f'Expected 2 groups, got {len(groups) - old_count}' @@ -201,7 +201,7 @@ def test_split_expense_grouping_with_same_and_different_ids(db, update_config_fo expense_group_settings.save() ExpenseGroup.create_expense_groups_by_report_id_fund_source(expense_objects, configuration, workspace_id) - groups = ExpenseGroup.objects.filter(expenses__expense_id__in=[expense['id'] for expense in expenses]) + groups = ExpenseGroup.objects.filter(expenses__expense_id__in=[expense['id'] for expense in expenses]).distinct() assert len(groups) - old_count == 2, f'Expected 2 groups, got {len(groups) - old_count}' @@ -240,6 +240,6 @@ def test_split_expense_grouping_pairs_of_same_ids(db, update_config_for_split_ex expense_group_settings.save() ExpenseGroup.create_expense_groups_by_report_id_fund_source(expense_objects, configuration, workspace_id) - groups = ExpenseGroup.objects.filter(expenses__expense_id__in=[expense['id'] for expense in expenses]) + groups = ExpenseGroup.objects.filter(expenses__expense_id__in=[expense['id'] for expense in expenses]).distinct() assert len(groups) - old_count== 2, f'Expected 2 groups, got {len(groups) - old_count}'