From a7bae952580f4da2a3a4badf241cc624084138e3 Mon Sep 17 00:00:00 2001 From: Bryann Valderrama Date: Fri, 27 Sep 2024 11:58:59 -0500 Subject: [PATCH] chore: use demo_course_id variable name instead course_id --- .../api/v1/tests/integration/test_views.py | 40 +++++++++---------- eox_core/settings/test.py | 2 +- 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/eox_core/api/v1/tests/integration/test_views.py b/eox_core/api/v1/tests/integration/test_views.py index b88a9c446..f9cf9693d 100644 --- a/eox_core/api/v1/tests/integration/test_views.py +++ b/eox_core/api/v1/tests/integration/test_views.py @@ -439,7 +439,7 @@ class TestEnrollmentAPIIntegration(BaseAPIIntegrationTest, UsersAPIRequestMixin, def setUp(self) -> None: """Set up the test suite""" super().setUp() - self.course_id = settings["COURSE_ID"] + self.demo_course_id = settings["DEMO_COURSE_ID"] self.mode = "audit" self.user = next(FAKE_USER_DATA) self.create_user(self.tenant_x, self.user) @@ -468,7 +468,7 @@ def test_create_enrollment_success(self, param: str, force_value: bool) -> None: """ enrollment_data = { param: self.user[param], - "course_id": self.course_id, + "course_id": self.demo_course_id, "mode": self.mode, "force": force_value, } @@ -506,7 +506,7 @@ def test_create_enrollment_missing_required_fields(self, param: str, error: list enrollment_data = { "username": self.user["username"], "mode": self.mode, - "course_id": self.course_id, + "course_id": self.demo_course_id, } enrollment_data_copy = deepcopy(enrollment_data) enrollment_data.pop(param) @@ -538,7 +538,7 @@ def test_create_valid_course_mode_invalid_user(self, param: str, value: str) -> """ enrollment_data = { param: value, - "course_id": self.course_id, + "course_id": self.demo_course_id, "mode": self.mode, } @@ -568,7 +568,7 @@ def test_create_valid_course_mode_invalid_user_for_tenant(self, param: str) -> N self.create_user(self.tenant_y, user_data) enrollment_data = { param: user_data[param], - "course_id": self.course_id, + "course_id": self.demo_course_id, "mode": self.mode, } @@ -627,7 +627,7 @@ def test_create_valid_user_mode_invalid_course_for_tenant(self, param: str) -> N """ enrollment_data = { param: self.user[param], - "course_id": self.course_id, + "course_id": self.demo_course_id, "mode": self.mode, } @@ -636,7 +636,7 @@ def test_create_valid_user_mode_invalid_course_for_tenant(self, param: str) -> N response_data = response.json() self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST) self.assertIn("course_id", response_data) - self.assertEqual(response_data["course_id"], [f"Invalid course_id {self.course_id}"]) + self.assertEqual(response_data["course_id"], [f"Invalid course_id {self.demo_course_id}"]) enrollment_response = self.get_enrollment(self.tenant_x, data=enrollment_data) self.assertEqual(enrollment_response.status_code, status.HTTP_404_NOT_FOUND) @@ -656,7 +656,7 @@ def test_create_valid_user_course_unavailable_mode(self, param: str) -> None: """ enrollment_data = { param: self.user[param], - "course_id": self.course_id, + "course_id": self.demo_course_id, "mode": "masters", } @@ -688,7 +688,7 @@ def test_force_create_valid_user_course_unavailable_mode(self, param: str) -> No """ enrollment_data = { param: self.user[param], - "course_id": self.course_id, + "course_id": self.demo_course_id, "mode": "masters", "force": True, } @@ -720,7 +720,7 @@ def test_get_enrollment_success(self, param: str) -> None: """ enrollment_data = { param: self.user[param], - "course_id": self.course_id, + "course_id": self.demo_course_id, "mode": self.mode, } self.create_enrollment(self.tenant_x, enrollment_data) @@ -750,7 +750,7 @@ def test_get_enrollment_does_not_exist(self, param: str) -> None: """ enrollment_data = { param: self.user[param], - "course_id": self.course_id, + "course_id": self.demo_course_id, } response = self.get_enrollment(self.tenant_x, data=enrollment_data) @@ -773,7 +773,7 @@ def test_get_enrollment_not_found_in_tenant(self, param: str) -> None: """ enrollment_data = { param: self.user[param], - "course_id": self.course_id, + "course_id": self.demo_course_id, "mode": self.mode, } self.create_enrollment(self.tenant_x, enrollment_data) @@ -803,7 +803,7 @@ def test_delete_enrollment_success(self, param: str) -> None: """ enrollment_data = { param: self.user[param], - "course_id": self.course_id, + "course_id": self.demo_course_id, "mode": self.mode, } self.create_enrollment(self.tenant_x, enrollment_data) @@ -829,7 +829,7 @@ def test_delete_enrollment_does_not_exist(self, param: str) -> None: """ enrollment_data = { param: self.user[param], - "course_id": self.course_id, + "course_id": self.demo_course_id, } response = self.delete_enrollment(self.tenant_x, data=enrollment_data) @@ -839,7 +839,7 @@ def test_delete_enrollment_does_not_exist(self, param: str) -> None: self.assertIn("detail", response_data) self.assertEqual( response_data["detail"], - f"No enrollment found for user: `{self.user['username']}` on course_id `{self.course_id}`", + f"No enrollment found for user: `{self.user['username']}` on course_id `{self.demo_course_id}`", ) @ddt.data("email", "username") @@ -858,7 +858,7 @@ def test_delete_invalid_enrollment_for_tenant(self, param: str) -> None: """ enrollment_data = { param: self.user[param], - "course_id": self.course_id, + "course_id": self.demo_course_id, "mode": self.mode, } self.create_enrollment(self.tenant_x, enrollment_data) @@ -890,7 +890,7 @@ def test_update_valid_enrollment_change_is_active_mode_field(self, param: str) - """ enrollment_data = { param: self.user[param], - "course_id": self.course_id, + "course_id": self.demo_course_id, "is_active": False, "mode": self.mode, } @@ -928,7 +928,7 @@ def test_update_valid_enrollment_update_unavailable_mode(self, param: str) -> No """ enrollment_data = { param: self.user[param], - "course_id": self.course_id, + "course_id": self.demo_course_id, "is_active": True, "mode": self.mode, } @@ -962,7 +962,7 @@ def test_update_enrollment_does_not_exist(self, param: str) -> None: """ enrollment_data = { param: self.user[param], - "course_id": self.course_id, + "course_id": self.demo_course_id, "is_active": False, "mode": self.mode, } @@ -993,7 +993,7 @@ def test_update_valid_enrollment_using_force_flag(self, param: str) -> None: """ enrollment_data = { param: self.user[param], - "course_id": self.course_id, + "course_id": self.demo_course_id, "is_active": False, "mode": self.mode, "force": True, diff --git a/eox_core/settings/test.py b/eox_core/settings/test.py index 0a9329e04..02387b9bd 100644 --- a/eox_core/settings/test.py +++ b/eox_core/settings/test.py @@ -112,5 +112,5 @@ def plugin_settings(settings): # pylint: disable=function-redefined "API_TIMEOUT": 5, "CLIENT_ID": "client_id", "CLIENT_SECRET": "client_secret", - "COURSE_ID": os.environ.get("COURSE_ID", "course-v1:OpenedX+DemoX+DemoCourse") + "DEMO_COURSE_ID": os.environ.get("DEMO_COURSE_ID", "course-v1:OpenedX+DemoX+DemoCourse") }