diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 06fe1c1..51d282e 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -1,4 +1,4 @@ -name: Run tests +name: CI on: pull_request: diff --git a/backend/requirements-test.txt b/backend/requirements-test.txt index 14808f7..8a80d46 100644 --- a/backend/requirements-test.txt +++ b/backend/requirements-test.txt @@ -1,4 +1,4 @@ -pytest==7.3.1 -pytest-django==4.5.2 -factory-boy==3.2.1 -pytest-bdd==7.0.1 +pytest==8.3.4 +pytest-django==4.10.0 +factory-boy==3.3.3 +pytest-bdd==8.1.0 diff --git a/backend/requirements.txt b/backend/requirements.txt index e455e0a..a451376 100644 --- a/backend/requirements.txt +++ b/backend/requirements.txt @@ -1,20 +1,20 @@ # Django -Django==4.2.5 -djangorestframework==3.14.0 -drf-nested-routers==0.93.4 -drf-spectacular==0.26.2 -psycopg2-binary==2.9.9 -django-unfold==0.16.0 # Django Admin Theme +Django==4.2.19 +djangorestframework==3.15.2 +drf-nested-routers==0.94.1 +drf-spectacular==0.28.0 +psycopg2-binary==2.9.10 +django-unfold==0.49.1 # Django Admin Theme # celery -celery==5.2.7 -redis==4.5.4 +celery==5.4.0 +redis==5.2.1 # excel -pandas==2.0.1 -openpyxl==3.1.2 +pandas==2.2.3 +openpyxl==3.1.5 -python-dotenv==1.0.0 +python-dotenv==1.0.1 # Formatter -black==23.3.0 +black==25.1.0 diff --git a/backend/tests/apis/v1/forms/form_create.feature b/backend/tests/apis/v1/forms/form_create.feature index aff06e6..65ff5c9 100644 --- a/backend/tests/apis/v1/forms/form_create.feature +++ b/backend/tests/apis/v1/forms/form_create.feature @@ -3,7 +3,7 @@ Feature: Form Create Test Scenario Outline: Form Create Permission Test Given I am a user. And I am logged in. - And The following data will be sent. + And The following data will be sent: """ { "slug": "test", @@ -23,7 +23,7 @@ Feature: Form Create Test Scenario: Form Create Test Given I am a staff user. And I am logged in. - And The following data will be sent. + And The following data will be sent: """ { "slug": "test", diff --git a/backend/tests/apis/v1/forms/form_delete.feature b/backend/tests/apis/v1/forms/form_delete.feature index 85eec77..a363095 100644 --- a/backend/tests/apis/v1/forms/form_delete.feature +++ b/backend/tests/apis/v1/forms/form_delete.feature @@ -1,7 +1,7 @@ @django_db Feature: Form Delete Test Background: - Given I will save the following data using Form model. + Given I will save the following data using Form model: """ { "id": 101, diff --git a/backend/tests/apis/v1/forms/form_list.feature b/backend/tests/apis/v1/forms/form_list.feature index 37a5c86..894415d 100644 --- a/backend/tests/apis/v1/forms/form_list.feature +++ b/backend/tests/apis/v1/forms/form_list.feature @@ -1,7 +1,7 @@ @django_db Feature: Form List Test Background: - Given I will save the following data using Form model. + Given I will save the following data using Form model: """ { "id": 101, diff --git a/backend/tests/apis/v1/forms/form_partial_update.feature b/backend/tests/apis/v1/forms/form_partial_update.feature index 86b87fe..3ef1196 100644 --- a/backend/tests/apis/v1/forms/form_partial_update.feature +++ b/backend/tests/apis/v1/forms/form_partial_update.feature @@ -1,7 +1,7 @@ @django_db Feature: Form Partial Update Test Background: - Given I will save the following data using Form model. + Given I will save the following data using Form model: """ { "id": 101, @@ -15,7 +15,7 @@ Feature: Form Partial Update Test Scenario Outline: Form Partial Update Permission Test Given I am a user. And I am logged in. - And The following data will be sent. + And The following data will be sent: """ { "title": "test1" @@ -33,7 +33,7 @@ Feature: Form Partial Update Test Scenario: Form Partial Update Test Given I am a staff user. And I am logged in. - And The following data will be sent. + And The following data will be sent: """ { "title": "test2" diff --git a/backend/tests/conftest.py b/backend/tests/conftest.py index 107ed6b..d83777d 100644 --- a/backend/tests/conftest.py +++ b/backend/tests/conftest.py @@ -71,12 +71,9 @@ def i_am_making_a_method_request_to_path(client, method, path): return response -@given( - parsers.parse("The following data will be sent.\n{data}"), - target_fixture="data", -) -def the_following_data_will_be_sent(data): - return json.loads(data) +@given(parsers.parse("The following data will be sent:"), target_fixture="data") +def the_following_data_will_be_sent(docstring): + return json.loads(docstring) @when( @@ -99,13 +96,13 @@ def i_am_sending_a_method_request_to_path_with_data(client, method, path, data): @given( - parsers.parse("I will save the following data using {model_class_name} model.\n{data}"), + parsers.cfparse("I will save the following data using {model_class_name} model:"), ) -def i_will_save_the_following_data_using_factory_class_name_from_module(model_class_name: str, data: str): +def i_will_save_the_following_data_using_factory_class_name_from_module(model_class_name: str, docstring): module = importlib.import_module("backend.tests.factories") factory_class_name = f"{model_class_name}Factory" factory_class = getattr(module, factory_class_name) - factory_class(**json.loads(data)) + factory_class(**json.loads(docstring)) return None