From 2e37796aec80b6fb8c3abac75405debf92c42a37 Mon Sep 17 00:00:00 2001 From: Shwetabh Kumar Date: Fri, 17 Nov 2023 09:21:36 +0530 Subject: [PATCH 1/3] Fixing typo in expense category (#451) * Fixing typo in expense category * Fixing tests * Fix tests --- apps/mappings/tasks.py | 6 +++--- tests/test_mappings/test_tasks.py | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/apps/mappings/tasks.py b/apps/mappings/tasks.py index 673cfdd7..7da04dba 100644 --- a/apps/mappings/tasks.py +++ b/apps/mappings/tasks.py @@ -226,8 +226,8 @@ def upload_categories_to_fyle(workspace_id: int, configuration: Configuration, p if configuration.import_categories: netsuite_accounts = DestinationAttribute.objects.filter( workspace_id=workspace_id, - attribute_type='EXPENSE_CATEGORY' if configuration.reimbursable_expenses_object == 'EXPENSE_REPORT' or configuration.corporate_credit_card_expenses_object == 'EXPENSE_REPORT' else 'ACCOUNT', - display_name='Expense Category' if configuration.reimbursable_expenses_object == 'EXPENSE_REPORT' or configuration.corporate_credit_card_expenses_object == 'EXPENSE_REPORT' else 'Account' + attribute_type='EXPENSE_CATEGORY' if configuration.reimbursable_expenses_object == 'EXPENSE REPORT' or configuration.corporate_credit_card_expenses_object == 'EXPENSE REPORT' else 'ACCOUNT', + display_name='Expense Category' if configuration.reimbursable_expenses_object == 'EXPENSE REPORT' or configuration.corporate_credit_card_expenses_object == 'EXPENSE REPORT' else 'Account' ) if netsuite_accounts: netsuite_attributes = netsuite_accounts @@ -480,7 +480,7 @@ def auto_create_category_mappings(workspace_id): employee_field_mapping = configuration.employee_field_mapping corporate_credit_card_expenses_object = configuration.corporate_credit_card_expenses_object - if configuration.reimbursable_expenses_object == 'EXPENSE_REPORT' or configuration.corporate_credit_card_expenses_object == 'EXPENSE_REPORT': + if configuration.reimbursable_expenses_object == 'EXPENSE REPORT' or configuration.corporate_credit_card_expenses_object == 'EXPENSE REPORT': reimbursable_destination_type = 'EXPENSE_CATEGORY' else: reimbursable_destination_type = 'ACCOUNT' diff --git a/tests/test_mappings/test_tasks.py b/tests/test_mappings/test_tasks.py index 112fa431..cb8f4d6f 100644 --- a/tests/test_mappings/test_tasks.py +++ b/tests/test_mappings/test_tasks.py @@ -291,7 +291,7 @@ def test_upload_categories_to_fyle(mocker, db): assert expense_category_count == 36 - assert len(netsuite_attributes) == 137 + assert len(netsuite_attributes) == 36 count_of_accounts = DestinationAttribute.objects.filter( attribute_type='ACCOUNT', workspace_id=49).count() @@ -338,7 +338,7 @@ def test_filter_unmapped_destinations(db, mocker): netsuite_attributes = upload_categories_to_fyle(workspace_id=1,configuration=configuration, platform=platform) destination_attributes = filter_unmapped_destinations('EXPENSE_CATEGORY', netsuite_attributes) - assert len(destination_attributes) == 124 + assert len(destination_attributes) == 33 def test_schedule_creation(db): @@ -389,7 +389,7 @@ def test_auto_create_category_mappings(db, mocker): assert response == None mappings_count = CategoryMapping.objects.filter(workspace_id=1).count() - assert mappings_count == 122 + assert mappings_count == 34 configuration = Configuration.objects.get(workspace_id=49) configuration.reimbursable_expenses_object = 'BILL' From ff8ea1fd44820a7e924e5879bbef03468e5a4b34 Mon Sep 17 00:00:00 2001 From: Ashutosh singh <55102089+Ashutosh619-sudo@users.noreply.github.com> Date: Fri, 17 Nov 2023 12:00:04 +0530 Subject: [PATCH 2/3] p0 bug fix test fix (#452) --- tests/test_fyle/test_helpers.py | 4 ++-- tests/test_netsuite/test_tasks.py | 4 ++-- tests/test_workspaces/data.json | 4 ++-- .../test_apis/test_export_settings/fixtures.py | 6 +++--- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/tests/test_fyle/test_helpers.py b/tests/test_fyle/test_helpers.py index 28a21a63..0adf1f55 100644 --- a/tests/test_fyle/test_helpers.py +++ b/tests/test_fyle/test_helpers.py @@ -34,9 +34,9 @@ def test_update_import_card_credits_flag(): expense_group_setting = ExpenseGroupSettings.objects.get(id=1) assert expense_group_setting.import_card_credits == True - update_import_card_credits_flag('BILL', 'EXPENSE_REPORT', 1) + update_import_card_credits_flag('BILL', 'EXPENSE REPORT', 1) expense_group_setting = ExpenseGroupSettings.objects.get(id=1) - assert expense_group_setting.import_card_credits == False + assert expense_group_setting.import_card_credits == True @pytest.mark.django_db() diff --git a/tests/test_netsuite/test_tasks.py b/tests/test_netsuite/test_tasks.py index 0e93b189..c20af8aa 100644 --- a/tests/test_netsuite/test_tasks.py +++ b/tests/test_netsuite/test_tasks.py @@ -1159,7 +1159,7 @@ def test_process_vendor_payment_expense_report(mocker, db): code='INVALID_KEY_OR_REF', message='An error occured in a upsert request: Invalid apacct reference key 223.' ) - process_vendor_payment(entity_object, 49, 'EXPENSE_REPORT') + process_vendor_payment(entity_object, 49, 'EXPENSE REPORT') task_log = TaskLog.objects.filter(workspace_id=49, type='CREATING_VENDOR_PAYMENT').last() @@ -1170,7 +1170,7 @@ def test_process_vendor_payment_expense_report(mocker, db): return_value=data['create_vendor_payment'] ) - process_vendor_payment(entity_object, 49, 'EXPENSE_REPORT') + process_vendor_payment(entity_object, 49, 'EXPENSE REPORT') task_log = TaskLog.objects.get(workspace_id=49, type='CREATING_VENDOR_PAYMENT') assert task_log.status == 'COMPLETE' diff --git a/tests/test_workspaces/data.json b/tests/test_workspaces/data.json index 27a52c14..c6453215 100644 --- a/tests/test_workspaces/data.json +++ b/tests/test_workspaces/data.json @@ -3,8 +3,8 @@ "id":1, "workspace":"Workspace object (1)", "employee_field_mapping":"EMPLOYEE", - "reimbursable_expenses_object":"EXPENSE_REPORT", - "corporate_credit_card_expenses_object":"EXPENSE_REPORT", + "reimbursable_expenses_object":"EXPENSE REPORT", + "corporate_credit_card_expenses_object":"EXPENSE REPORT", "import_categories":true, "import_tax_items":false, "import_projects":true, diff --git a/tests/test_workspaces/test_apis/test_export_settings/fixtures.py b/tests/test_workspaces/test_apis/test_export_settings/fixtures.py index 003f082f..421ca7bf 100644 --- a/tests/test_workspaces/test_apis/test_export_settings/fixtures.py +++ b/tests/test_workspaces/test_apis/test_export_settings/fixtures.py @@ -46,7 +46,7 @@ }, 'response': { 'configuration': { - 'reimbursable_expenses_object': 'EXPENSE_REPORT', + 'reimbursable_expenses_object': 'EXPENSE REPORT', 'corporate_credit_card_expenses_object': 'CHARGE_CARD_TRANSACTION', 'is_simplify_report_closure_enabled': False, }, @@ -133,7 +133,7 @@ }, 'export_settings_missing_values_expense_group_settings': { 'configurations': { - 'reimbursable_expenses_object': 'EXPENSE_REPORT', + 'reimbursable_expenses_object': 'EXPENSE REPORT', 'corporate_credit_card_expenses_object': 'CHARGE_CARD_TRANSACTION', 'is_simplify_report_closure_enabled': False, }, @@ -159,7 +159,7 @@ }, 'export_settings_missing_values_general_mappings': { 'configurations': { - 'reimbursable_expenses_object': 'EXPENSE_REPORT', + 'reimbursable_expenses_object': 'EXPENSE REPORT', 'corporate_credit_card_expenses_object': 'CHARGE_CARD_TRANSACTION', 'is_simplify_report_closure_enabled': False, }, From 07ecdcd02c3a099c8eef88d866fc52ccf64e1673 Mon Sep 17 00:00:00 2001 From: Shwetabh Kumar Date: Fri, 17 Nov 2023 12:46:56 +0530 Subject: [PATCH 3/3] feat: Unspecified should always be enabled (#453) --- apps/mappings/tasks.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/mappings/tasks.py b/apps/mappings/tasks.py index 7da04dba..f36b34d3 100644 --- a/apps/mappings/tasks.py +++ b/apps/mappings/tasks.py @@ -167,7 +167,7 @@ def create_fyle_categories_payload(categories: List[DestinationAttribute], categ 'id': category.source_id, 'name': category.value, 'code': destination_id_of_category, - 'is_enabled': category.active + 'is_enabled': category.active if category.value != 'Unspecified' else True }) else: for category in categories: