diff --git a/backend/tests/api/v1/employees/test_email_verification_security.py b/backend/tests/api/v1/employees/test_email_verification_security.py index 0b752c95..bfb7cb9f 100644 --- a/backend/tests/api/v1/employees/test_email_verification_security.py +++ b/backend/tests/api/v1/employees/test_email_verification_security.py @@ -18,7 +18,7 @@ Employee = get_user_model() @pytest.fixture(autouse=True) def disable_ldap(): """Отключает LDAP для всех тестов.""" - with patch("api.v1.employees.views._is_ldap_enabled", return_value=False): + with patch("api.v1.employees.views._helpers._is_ldap_enabled", return_value=False): yield @pytest.fixture diff --git a/backend/tests/api/v1/employees/test_employee_actions.py b/backend/tests/api/v1/employees/test_employee_actions.py index 187a0122..5c6f9ba1 100644 --- a/backend/tests/api/v1/employees/test_employee_actions.py +++ b/backend/tests/api/v1/employees/test_employee_actions.py @@ -217,7 +217,7 @@ def test_delete_requires_perm_or_staff(api_client): @pytest.mark.django_db -@patch('api.v1.employees.views._is_ldap_enabled') +@patch('api.v1.employees.views._helpers._is_ldap_enabled') @patch('employees.ldap.directory_service.DirectoryService.update_user') def test_dismissal_syncs_to_ldap_if_has_dn( mock_update, mock_is_enabled, api_client @@ -262,7 +262,7 @@ def test_dismissal_syncs_to_ldap_if_has_dn( @pytest.mark.django_db -@patch('api.v1.employees.views._is_ldap_enabled') +@patch('api.v1.employees.views._helpers._is_ldap_enabled') @patch('employees.ldap.directory_service.DirectoryService.update_user') def test_dismissal_handles_ldap_error_gracefully( mock_update, mock_is_enabled, api_client @@ -308,7 +308,7 @@ def test_dismissal_handles_ldap_error_gracefully( @pytest.mark.django_db -@patch('api.v1.employees.views._is_ldap_enabled') +@patch('api.v1.employees.views._helpers._is_ldap_enabled') @patch('employees.ldap.directory_service.DirectoryService.update_user') def test_non_dismissal_syncs_activation_to_ldap( mock_update, mock_is_enabled, api_client @@ -355,7 +355,7 @@ def test_non_dismissal_syncs_activation_to_ldap( @pytest.mark.django_db -@patch('api.v1.employees.views._is_ldap_enabled') +@patch('api.v1.employees.views._helpers._is_ldap_enabled') @patch('employees.ldap.directory_service.DirectoryService.update_user') def test_dismissal_skips_ldap_if_no_dn( mock_update, mock_is_enabled, api_client @@ -388,7 +388,7 @@ def test_dismissal_skips_ldap_if_no_dn( @pytest.mark.django_db -@patch('api.v1.employees.views._is_ldap_enabled') +@patch('api.v1.employees.views._helpers._is_ldap_enabled') @patch('employees.ldap.directory_service.DirectoryService.update_user') def test_dismissal_works_when_ldap_disabled( mock_update, mock_is_enabled, api_client @@ -431,7 +431,7 @@ def test_dismissal_works_when_ldap_disabled( @pytest.mark.django_db -@patch('api.v1.employees.views._is_ldap_enabled') +@patch('api.v1.employees.views._helpers._is_ldap_enabled') @patch('employees.ldap.directory_service.DirectoryService.remove_member') @patch('employees.ldap.directory_service.DirectoryService.update_user') def test_dismissal_moves_to_dismissed_ou( @@ -491,7 +491,7 @@ def test_dismissal_moves_to_dismissed_ou( @pytest.mark.django_db -@patch('api.v1.employees.views._is_ldap_enabled') +@patch('api.v1.employees.views._helpers._is_ldap_enabled') @patch('employees.ldap.infrastructure.connections._ldap') @patch('employees.ldap.directory_service.DirectoryService.update_user') def test_restoration_moves_from_dismissed_to_users( @@ -550,7 +550,7 @@ def test_restoration_moves_from_dismissed_to_users( @pytest.mark.django_db -@patch('api.v1.employees.views._is_ldap_enabled') +@patch('api.v1.employees.views._helpers._is_ldap_enabled') @patch('employees.ldap.infrastructure.connections._ldap') @patch('employees.ldap.directory_service.DirectoryService.update_user') def test_dismissal_without_department_moves_to_dismissed( diff --git a/backend/tests/api/v1/employees/test_employees.py b/backend/tests/api/v1/employees/test_employees.py index f124e280..933f8b8d 100644 --- a/backend/tests/api/v1/employees/test_employees.py +++ b/backend/tests/api/v1/employees/test_employees.py @@ -35,7 +35,6 @@ def _unique_phone() -> str: # валидный уникальный E.164 return f"+7999000{next(_phone_seq):03d}" -@pytest.fixture def make_user( email: str, *, @@ -45,7 +44,7 @@ def make_user( active: bool = True, **extra, ) -> User: - """Fixture для создания пользователей.""" + """Helper для создания пользователей в тестах.""" """ Создаём пользователя напрямую (без менеджера, чтобы не слать почту). """