-
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.
Added tests for previous bug reports (#352)
* modified mappings and workspace tests * modified tests for fyle, mappings, workspace modules, 96.5% coverage * modified quickbooks module tests (#350) * modified quickbooks module tests * fixed comments * Add tests for prev bug reports * fixed comments
- Loading branch information
1 parent
45351d2
commit 696ea05
Showing
7 changed files
with
112 additions
and
23 deletions.
There are no files selected for viewing
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
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
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 |
---|---|---|
@@ -1,9 +1,6 @@ | ||
import random | ||
import pytest | ||
from apps.fyle.models import _format_date, _group_expenses | ||
from apps.fyle.models import * | ||
from .fixtures import data | ||
import datetime | ||
|
||
def test_default_fields(): | ||
expense_group_field = get_default_expense_group_fields() | ||
|
@@ -64,12 +61,14 @@ def test_create_expense_groups_by_report_id_fund_source(db): | |
expense_group_settings.ccc_export_date_type = 'last_spent_at' | ||
expense_group_settings.save() | ||
|
||
field = ExpenseAttribute.objects.filter(workspace_id=workspace_id).first() | ||
field.attribute_type = 'COOL' | ||
field = ExpenseAttribute.objects.filter(workspace_id=workspace_id, attribute_type='PROJECT').last() | ||
field.attribute_type = 'KILLUA' | ||
field.save() | ||
|
||
expense_groups = _group_expenses([], ['claim_number', 'fund_source', 'projects', 'employee_email', 'report_id', 'cool'], 4) | ||
assert expense_groups == [] | ||
expenses = Expense.objects.filter(id=33).all() | ||
|
||
expense_groups = _group_expenses(expenses, ['claim_number', 'fund_source', 'project', 'employee_email', 'report_id', 'Killua'], 4) | ||
assert expense_groups == [{'claim_number': 'C/2022/05/R/6', 'fund_source': 'PERSONAL', 'project': 'Bebe Rexha', 'employee_email': '[email protected]', 'report_id': 'rpawE81idoYo', 'killua': '', 'total': 1, 'expense_ids': [33]}] | ||
|
||
expense_groups = ExpenseGroup.create_expense_groups_by_report_id_fund_source([expense_objects], workspace_id) | ||
assert len(expense_groups) == 1 | ||
|
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 |
---|---|---|
@@ -1,23 +1,27 @@ | ||
from django.urls import reverse | ||
import pytest | ||
|
||
from tests.test_fyle.fixtures import data as fyle_data | ||
|
||
# Will use paramaterize decorator of python later | ||
@pytest.mark.django_db(databases=['default']) | ||
def test_get_profile_view(api_client, test_connection): | ||
|
||
access_token = test_connection.access_token | ||
url = reverse('profile') | ||
api_client.credentials(HTTP_AUTHORIZATION='Bearer {}'.format(access_token)) | ||
api_client.credentials(HTTP_AUTHORIZATION='Bearer {}'.format(test_connection.access_token)) | ||
|
||
response = api_client.get(url) | ||
assert response.status_code == 200 | ||
|
||
def test_get_fyle_orgs_view(mocker, api_client, test_connection): | ||
|
||
@pytest.mark.django_db(databases=['default']) | ||
def test_get_fyle_orgs_view(api_client, test_connection, mocker): | ||
mocker.patch( | ||
'apps.users.views.get_fyle_orgs', | ||
return_value=['fyleforgotham.in'] | ||
return_value=fyle_data['get_all_orgs'] | ||
) | ||
access_token = test_connection.access_token | ||
url = reverse('orgs') | ||
api_client.credentials(HTTP_AUTHORIZATION='Bearer {}'.format(access_token)) | ||
api_client.credentials(HTTP_AUTHORIZATION='Bearer {}'.format(test_connection.access_token)) | ||
|
||
response = api_client.get(url) | ||
assert response.status_code == 200 |
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
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
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