Skip to content

Commit

Permalink
Update import tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dchiquito committed Feb 9, 2022
1 parent a2b1b50 commit 60b8f60
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions miqa/core/tests/test_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

import pytest
from rest_framework.exceptions import APIException
from guardian.shortcuts import get_perms

from miqa.core.tasks import import_data

Expand Down Expand Up @@ -86,7 +87,7 @@ def test_import_csv(tmp_path, user, project_factory, sample_scans, user_api_clie
user_api_client = user_api_client(project=project)

resp = user_api_client.post(f'/api/v1/projects/{project.id}/import')
if user.is_superuser:
if get_perms(user, project):
assert resp.status_code == 204
# The import should update the project, even though the names do not match
project.refresh_from_db()
Expand Down Expand Up @@ -115,7 +116,7 @@ def test_import_global_csv(tmp_path, user, project_factory, sample_scans, user_a
user_api_client = user_api_client(project=project)

resp = user_api_client.post(f'/api/v1/projects/{project.id}/import')
if user.is_superuser:
if get_perms(user, project):
assert resp.status_code == 204
# The import should update the correctly named projects, but not the original import project
project.refresh_from_db()
Expand Down Expand Up @@ -147,7 +148,7 @@ def test_import_json(
project = project_factory(import_path=json_file)

resp = user_api_client(project=project).post(f'/api/v1/projects/{project.id}/import')
if user.is_superuser:
if get_perms(user, project):
assert resp.status_code == 204
# The import should update the project, even though the names do not match
project.refresh_from_db()
Expand Down Expand Up @@ -181,7 +182,7 @@ def test_import_global_json(
user_api_client = user_api_client(project=project)

resp = user_api_client.post(f'/api/v1/projects/{project.id}/import')
if user.is_superuser:
if get_perms(user, project):
assert resp.status_code == 204
# The import should update the correctly named projects, but not the original import project
project.refresh_from_db()
Expand Down

0 comments on commit 60b8f60

Please sign in to comment.