fix(user): remove email from accounts
All checks were successful
CI/CD Pipeline / Code Quality Checks (pull_request) Successful in 2m11s
CI/CD Pipeline / Run Tests (pull_request) Successful in 4m32s
CI/CD Pipeline / Build and Push Dev Images (pull_request) Has been skipped
CI/CD Pipeline / Deploy Dev via Compose (pull_request) Has been skipped
CI/CD Pipeline / Code Quality Checks (push) Successful in 1m20s
CI/CD Pipeline / Run Tests (push) Successful in 3m21s
CI/CD Pipeline / Build and Push Dev Images (push) Has been skipped
CI/CD Pipeline / Deploy Dev via Compose (push) Has been skipped

This commit was merged in pull request #33.
This commit is contained in:
Aleksandr Meshchryakov
2026-10-01 10:20:01 +02:00
parent f3b731935e
commit e61f92200d
24 changed files with 239 additions and 295 deletions

View File

@@ -25,7 +25,6 @@ class RegisterViewTest(APITestCase):
self.register_url = reverse("api_v1:user:register")
self.password = fake.password(length=12, special_chars=False)
self.user_data = {
"email": fake.unique.email(),
"username": fake.unique.user_name(),
"password": self.password,
"password_confirm": self.password,
@@ -43,7 +42,9 @@ class RegisterViewTest(APITestCase):
self.assertIn("access", response.data["tokens"])
# Verify user was created
self.assertTrue(User.objects.filter(email=self.user_data["email"]).exists())
self.assertTrue(
User.objects.filter(username=self.user_data["username"]).exists()
)
def test_register_passwords_do_not_match(self):
"""Test registration fails when passwords don't match"""
@@ -55,20 +56,6 @@ class RegisterViewTest(APITestCase):
self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)
self.assertIn("non_field_errors", response.data)
def test_register_duplicate_email(self):
"""Test registration fails with duplicate email"""
# Create existing user
existing_user = UserFactory.create_user()
# Use the same email as existing user
data = self.user_data.copy()
data["email"] = existing_user.email
response = self.client.post(self.register_url, data, format="json")
self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)
self.assertIn("email", response.data)
def test_register_short_password(self):
"""Test registration fails with short password"""
short_password = fake.pystr(min_chars=3, max_chars=5)
@@ -138,7 +125,6 @@ class CurrentUserViewTest(APITestCase):
self.assertEqual(response.status_code, status.HTTP_200_OK)
self.assertEqual(response.data["id"], self.user.id)
self.assertEqual(response.data["email"], self.user.email)
self.assertEqual(response.data["is_active"], self.user.is_active)
self.assertIn("profile", response.data)
self.assertEqual(response.data["profile"]["middle_name"], "")
@@ -283,7 +269,6 @@ class AdminUserCrudViewTest(APITestCase):
def test_admin_can_create_user_with_role_and_profile(self):
password = fake.password(length=12, special_chars=False)
payload = {
"email": fake.unique.email(),
"username": fake.unique.user_name(),
"phone": f"+7{fake.numerify('##########')}",
"password": password,
@@ -311,8 +296,7 @@ class AdminUserCrudViewTest(APITestCase):
duplicate_response = self.client.post(
self.list_url,
{
"email": self.regular_user.email,
"username": fake.unique.user_name(),
"username": self.regular_user.username,
"password": "valid-pass",
"first_name": "Иван",
"last_name": "Иванов",
@@ -322,7 +306,6 @@ class AdminUserCrudViewTest(APITestCase):
password_response = self.client.post(
self.list_url,
{
"email": fake.unique.email(),
"username": fake.unique.user_name(),
"password": "short",
"first_name": "Иван",