Skip to content

Commit

Permalink
Bug fix for import-categories (#253)
Browse files Browse the repository at this point in the history
* Bug fix for import-categories

* adding test

* adding test
  • Loading branch information
labhvam5 authored Aug 18, 2023
1 parent a1c8283 commit fbea2b6
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 5 deletions.
11 changes: 6 additions & 5 deletions apps/mappings/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,11 +116,12 @@ def create_fyle_categories_payload(categories: List[DestinationAttribute], works
})
else:
for category in categories:
payload.append({
'name': category.value,
'code': category.destination_id,
'is_enabled': True
})
if category.value.lower() not in category_map:
payload.append({
'name': category.value,
'code': category.destination_id,
'is_enabled': category.active
})
return payload

def get_all_categories_from_fyle(platform: PlatformConnector):
Expand Down
16 changes: 16 additions & 0 deletions tests/test_workspaces/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,11 @@ def test_connect_xero_view(api_client, test_connection):
response = api_client.get(url)
assert response.status_code == 200

XeroCredentials.objects.filter(workspace_id=workspace_id).delete()

response = api_client.get(url)
assert response.status_code == 400


def test_revoke_xero_connection(mocker, api_client, test_connection):
mocker.patch(
Expand Down Expand Up @@ -334,3 +339,14 @@ def test_last_export_detail(mocker, api_client, test_connection):

response = api_client.get(url)
assert response.status_code == 200


def test_get_admin_of_workspaces(api_client, test_connection):
workspace_id = 1

url = '/api/workspaces/{}/admins/'.format(workspace_id)

api_client.credentials(HTTP_AUTHORIZATION='Bearer {}'.format(test_connection.access_token))

response = api_client.get(url)
assert response.status_code == 200

0 comments on commit fbea2b6

Please sign in to comment.