diff --git a/eox_nelp/tests/test_utils.py b/eox_nelp/tests/test_utils.py index 1fe098f4..2c9893d5 100644 --- a/eox_nelp/tests/test_utils.py +++ b/eox_nelp/tests/test_utils.py @@ -4,7 +4,7 @@ ExtractCourseIdFromStringTestCase: Tests cases for the extract_course_id_from_string method. GetCourseFromIdTestCase: Tests cases for the get_course_from_id method. """ -from ddt import data, ddt +from ddt import data, ddt, unpack from django.contrib.auth import get_user_model from django.test import TestCase from mock import Mock, patch @@ -237,19 +237,18 @@ def test_invalid_input(self, input_value): class SaveExtraInfoFieldTestCase(TestCase): """Test class for the save_extrainfo_field method.""" @data( - ("arabic_name", "أناكين سكاي ووكر"), - ("is_phone_validated", True), - ("arabic_first_name", " أناكين"), - ("arabic_last_name", "سكاي ووكر"), + {"field": "arabic_name", "value": "أناكين سكاي ووكر"}, + {"field": "is_phone_validated", "value": True}, + {"field": "arabic_first_name", "value": " أناكين"}, + {"field": "arabic_last_name", "value": "سكاي ووكر"}, ) - def test_save_extrainfo_field(self, test_data): + @unpack + def test_save_extrainfo_field(self, field, value): """ Test right functionality. Expected behavior: - Extrainfo related objed has the expected value. """ - field = test_data[0] - value = test_data[1] user, _ = User.objects.get_or_create(username="vader1798") save_extrainfo_field(user, field, value) @@ -257,17 +256,16 @@ def test_save_extrainfo_field(self, test_data): self.assertEqual(getattr(user.extrainfo, field), value) @data( - ("arabic_name2", "loool"), - ("otp-crazy", True), + {"field": "arabic_name2", "value": "loool"}, + {"field": "otp-crazy", "value": True}, ) - def test_wrong_extra_info_field(self, test_data): + @unpack + def test_wrong_extra_info_field(self, field, value): """ Test when the input is not a extra info field. Expected behavior: - The user has no extra info model. """ - field = test_data[0] - value = test_data[1] user, _ = User.objects.get_or_create(username="vader19") save_extrainfo_field(user, field, value)