Skip to content

Commit

Permalink
Remove redundant pytest.params
Browse files Browse the repository at this point in the history
  • Loading branch information
Eg0ra committed Nov 1, 2024
1 parent 3fc791c commit 1edff43
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 150 deletions.
17 changes: 4 additions & 13 deletions test_project/tests/integration_tests/test_admin/test_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,20 +128,11 @@ def test_celery_export_status_view_during_export(


@pytest.mark.parametrize(
argnames=["incorrect_job_status"],
argnames="incorrect_job_status",
argvalues=[
pytest.param(
ExportJob.ExportStatus.CREATED,
id="Get export job results page with `CREATED` status",
),
pytest.param(
ExportJob.ExportStatus.EXPORTING,
id="Get export job results page with `EXPORTING` status",
),
pytest.param(
ExportJob.ExportStatus.CANCELLED,
id="Get export job results page with `CANCELLED` status",
),
ExportJob.ExportStatus.CREATED,
ExportJob.ExportStatus.EXPORTING,
ExportJob.ExportStatus.CANCELLED,
],
)
def test_celery_export_results_view_redirect_to_status_page(
Expand Down
49 changes: 11 additions & 38 deletions test_project/tests/integration_tests/test_admin/test_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,32 +156,14 @@ def test_celery_import_status_view_during_import(


@pytest.mark.parametrize(
argnames=["incorrect_job_status"],
argnames="incorrect_job_status",
argvalues=[
pytest.param(
ImportJob.ImportStatus.CREATED,
id="Get import job results page with `CREATED` status",
),
pytest.param(
ImportJob.ImportStatus.PARSING,
id="Get import job results page with `IMPORT_ERROR` status",
),
pytest.param(
ImportJob.ImportStatus.PARSE_ERROR,
id="Get import job results page with `PARSE_ERROR` status",
),
pytest.param(
ImportJob.ImportStatus.CONFIRMED,
id="Get import job results page with `CONFIRMED` status",
),
pytest.param(
ImportJob.ImportStatus.IMPORTING,
id="Get import job results page with `IMPORTING` status",
),
pytest.param(
ImportJob.ImportStatus.CANCELLED,
id="Get import job results page with `CANCELLED` status",
),
ImportJob.ImportStatus.CREATED,
ImportJob.ImportStatus.PARSING,
ImportJob.ImportStatus.PARSE_ERROR,
ImportJob.ImportStatus.CONFIRMED,
ImportJob.ImportStatus.IMPORTING,
ImportJob.ImportStatus.CANCELLED,
],
)
def test_celery_import_results_view_redirect_to_status_page(
Expand Down Expand Up @@ -214,20 +196,11 @@ def test_celery_import_results_view_redirect_to_status_page(


@pytest.mark.parametrize(
argnames=["incorrect_job_status"],
argnames="incorrect_job_status",
argvalues=[
pytest.param(
ImportJob.ImportStatus.INPUT_ERROR,
id="Confirm import job with `INPUT_ERROR` status",
),
pytest.param(
ImportJob.ImportStatus.IMPORT_ERROR,
id="Confirm import job with `IMPORT_ERROR` status",
),
pytest.param(
ImportJob.ImportStatus.IMPORTED,
id="Confirm import job with `IMPORTED` status",
),
ImportJob.ImportStatus.INPUT_ERROR,
ImportJob.ImportStatus.IMPORT_ERROR,
ImportJob.ImportStatus.IMPORTED,
],
)
def test_celery_import_results_confirm_forbidden(
Expand Down
29 changes: 7 additions & 22 deletions test_project/tests/integration_tests/test_api/test_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,16 +70,10 @@ def test_export_api_detail(

@pytest.mark.django_db(transaction=True)
@pytest.mark.parametrize(
argnames=["allowed_cancel_status"],
argnames="allowed_cancel_status",
argvalues=[
pytest.param(
ExportJob.ExportStatus.CREATED,
id="Cancel job with `CREATED` status",
),
pytest.param(
ExportJob.ExportStatus.EXPORTING,
id="Cancel job with `EXPORTING` status",
),
ExportJob.ExportStatus.CREATED,
ExportJob.ExportStatus.EXPORTING,
],
)
def test_export_api_cancel(
Expand All @@ -103,20 +97,11 @@ def test_export_api_cancel(

@pytest.mark.django_db(transaction=True)
@pytest.mark.parametrize(
argnames=["incorrect_job_status"],
argnames="incorrect_job_status",
argvalues=[
pytest.param(
ExportJob.ExportStatus.EXPORT_ERROR,
id="Cancel export job with `EXPORT_ERROR` status",
),
pytest.param(
ExportJob.ExportStatus.EXPORTED,
id="Cancel export job with `EXPORTED` status",
),
pytest.param(
ExportJob.ExportStatus.CANCELLED,
id="Cancel export job with `CANCELLED` status",
),
ExportJob.ExportStatus.EXPORT_ERROR,
ExportJob.ExportStatus.EXPORTED,
ExportJob.ExportStatus.CANCELLED,
],
)
def test_export_api_cancel_with_errors(
Expand Down
96 changes: 21 additions & 75 deletions test_project/tests/integration_tests/test_api/test_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,44 +197,17 @@ def test_import_api_confirm_parsed_job(

@pytest.mark.django_db(transaction=True)
@pytest.mark.parametrize(
argnames=["incorrect_job_status"],
argnames="incorrect_job_status",
argvalues=[
pytest.param(
ImportJob.ImportStatus.CREATED,
id="Confirm import job with `CREATED` status",
),
pytest.param(
ImportJob.ImportStatus.PARSING,
id="Confirm import job with `PARSING` status",
),
pytest.param(
ImportJob.ImportStatus.PARSE_ERROR,
id="Confirm import job with `PARSE_ERROR` status",
),
pytest.param(
ImportJob.ImportStatus.CONFIRMED,
id="Confirm import job with `CONFIRMED` status",
),
pytest.param(
ImportJob.ImportStatus.INPUT_ERROR,
id="Confirm import job with `INPUT_ERROR` status",
),
pytest.param(
ImportJob.ImportStatus.IMPORTING,
id="Confirm import job with `IMPORTING` status",
),
pytest.param(
ImportJob.ImportStatus.IMPORT_ERROR,
id="Confirm import job with `IMPORT_ERROR` status",
),
pytest.param(
ImportJob.ImportStatus.IMPORTED,
id="Confirm import job with `IMPORTED` status",
),
pytest.param(
ImportJob.ImportStatus.CANCELLED,
id="Confirm import job with `CANCELLED` status",
),
ImportJob.ImportStatus.CREATED,
ImportJob.ImportStatus.PARSING,
ImportJob.ImportStatus.PARSE_ERROR,
ImportJob.ImportStatus.CONFIRMED,
ImportJob.ImportStatus.INPUT_ERROR,
ImportJob.ImportStatus.IMPORTING,
ImportJob.ImportStatus.IMPORT_ERROR,
ImportJob.ImportStatus.IMPORTED,
ImportJob.ImportStatus.CANCELLED,
],
)
def test_import_api_confirm_incorrect_job_status(
Expand Down Expand Up @@ -262,24 +235,12 @@ def test_import_api_confirm_incorrect_job_status(

@pytest.mark.django_db(transaction=True)
@pytest.mark.parametrize(
argnames=["allowed_cancel_status"],
argnames="allowed_cancel_status",
argvalues=[
pytest.param(
ImportJob.ImportStatus.CREATED,
id="Cancel import job with `CREATED` status",
),
pytest.param(
ImportJob.ImportStatus.PARSING,
id="Cancel import job with `PARSING` status",
),
pytest.param(
ImportJob.ImportStatus.IMPORTING,
id="Cancel import job with `IMPORTING` status",
),
pytest.param(
ImportJob.ImportStatus.CONFIRMED,
id="Cancel import job with `CONFIRMED` status",
),
ImportJob.ImportStatus.CREATED,
ImportJob.ImportStatus.PARSING,
ImportJob.ImportStatus.IMPORTING,
ImportJob.ImportStatus.CONFIRMED,
],
)
def test_import_api_cancel_job(
Expand All @@ -303,28 +264,13 @@ def test_import_api_cancel_job(

@pytest.mark.django_db(transaction=True)
@pytest.mark.parametrize(
argnames=["incorrect_job_status"],
argnames="incorrect_job_status",
argvalues=[
pytest.param(
ImportJob.ImportStatus.INPUT_ERROR,
id="Cancel import job with `INPUT_ERROR` status",
),
pytest.param(
ImportJob.ImportStatus.PARSE_ERROR,
id="Cancel import job with `PARSE_ERROR` status",
),
pytest.param(
ImportJob.ImportStatus.IMPORT_ERROR,
id="Cancel import job with `IMPORT_ERROR` status",
),
pytest.param(
ImportJob.ImportStatus.IMPORTED,
id="Cancel import job with `IMPORTED` status",
),
pytest.param(
ImportJob.ImportStatus.CANCELLED,
id="Cancel import job with `CANCELLED` status",
),
ImportJob.ImportStatus.INPUT_ERROR,
ImportJob.ImportStatus.PARSE_ERROR,
ImportJob.ImportStatus.IMPORT_ERROR,
ImportJob.ImportStatus.IMPORTED,
ImportJob.ImportStatus.CANCELLED,
],
)
def test_import_api_cancel_incorrect_job_status(
Expand Down
4 changes: 2 additions & 2 deletions test_project/tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ def test_clear_q_filter():
f"http://{AWS_STORAGE_BUCKET_NAME}.s3.region.com/dir/file.csv",
"dir/file.csv",
id=(
"File from s3 bucket if using virtual addressing style:"
"https://docs.aws.amazon.com/AmazonS3/latest/userguide/VirtualHosting.html"
# https://docs.aws.amazon.com/AmazonS3/latest/userguide/VirtualHosting.html
"File from s3 bucket if using virtual addressing style."
),
),
],
Expand Down

0 comments on commit 1edff43

Please sign in to comment.