Merge branch 'master' of gitlab.prodcontest.ru:team-15/project

This commit is contained in:
ITQ
2025-03-01 02:45:49 +03:00
10 changed files with 197 additions and 17 deletions
@@ -0,0 +1,18 @@
# Generated by Django 5.1.6 on 2025-02-28 22:40
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('user', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='user',
name='status',
field=models.CharField(choices=[('student', 'Student'), ('metodist', 'Metodist')], default='student', max_length=10),
),
]
@@ -0,0 +1,18 @@
# Generated by Django 5.1.6 on 2025-02-28 22:45
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('user', '0002_user_status'),
]
operations = [
migrations.AlterField(
model_name='user',
name='status',
field=models.CharField(choices=[('student', 'Student'), ('metodist', 'Metodist')], default='student', max_length=10),
),
]
+1 -1
View File
@@ -14,7 +14,7 @@ class User(BaseModel):
password = models.TextField(verbose_name="Пароль")
status = models.CharField(
max_length=10, choices=UserRole.choices, default=UserRole.STUDENT
max_length=10, choices=UserRole, default="student"
)
def __str__(self) -> str:
+32
View File
@@ -0,0 +1,32 @@
from django.core.exceptions import ValidationError
from django.test import TestCase
from apps.user.models import User
class TestSignUp(TestCase):
def test_correct_signup(self):
user = User(
email="123123@timka.su",
password="1321312",
username="123123",
)
user.full_clean()
user.save()
def test_incorrect_mail(self):
user = User(
email="123123",
password="1321312",
username="123123123",
)
with self.assertRaises(ValidationError):
user.full_clean()
def test_missing_params(self):
user = User(
password="123123",
username="132131232131"
)
with self.assertRaises(ValidationError):
user.full_clean()