Skip to content

Commit

Permalink
Refactor tests
Browse files Browse the repository at this point in the history
  • Loading branch information
yalef committed Nov 30, 2023
1 parent c09957d commit 8e12ea0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
4 changes: 4 additions & 0 deletions tests/test_api/test_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ def test_import_api_detail(
kwargs={"pk": artist_import_job.id},
),
)
assert response.status_code == status.HTTP_200_OK, response.data
assert response.data["import_status"] == ImportJob.ImportStatus.PARSED

artist_import_job.refresh_from_db()
Expand All @@ -51,6 +52,7 @@ def test_import_api_detail(
kwargs={"pk": artist_import_job.id},
),
)
assert response.status_code == status.HTTP_200_OK, response.data
assert response.data["import_finished"]


Expand All @@ -73,6 +75,7 @@ def test_force_import_api_detail(
kwargs={"pk": force_import_artist_job.id},
),
)
assert response.status_code == status.HTTP_200_OK, response.data
assert response.data["import_status"] == ImportJob.ImportStatus.PARSED

force_import_artist_job.refresh_from_db()
Expand All @@ -84,6 +87,7 @@ def test_force_import_api_detail(
kwargs={"pk": force_import_artist_job.id},
),
)
assert response.status_code == status.HTTP_200_OK, response.data
assert response.data["import_finished"]

force_import_artist_job.refresh_from_db()
Expand Down
8 changes: 5 additions & 3 deletions tests/test_models/test_import/test_import_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,10 @@ def test_import_data_skip_parse_step(
import_job.refresh_from_db()

assert import_job.import_status == expected_status
if is_instance_created:
assert Artist.objects.filter(name=new_artist.name).exists()
assert (
Artist.objects.filter(name=new_artist.name).exists()
== is_instance_created
)


def test_force_import_create_correct_rows(
Expand All @@ -139,5 +141,5 @@ def test_force_import_create_correct_rows(
)
import_job.import_data()
import_job.refresh_from_db()
assert import_job.ImportStatus.IMPORTED
assert import_job.import_status == import_job.ImportStatus.IMPORTED
assert Artist.objects.filter(name=new_artist.name).exists()

0 comments on commit 8e12ea0

Please sign in to comment.