forked from mathialm/secfit
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Sondre Malerud
committed
Apr 1, 2025
1 parent
650a0b3
commit 0439e15
Showing
3 changed files
with
36 additions
and
16 deletions.
There are no files selected for viewing
Empty file.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| from django.test import TestCase | ||
| from users.models import User | ||
| from users.serializers import UserSerializer | ||
|
|
||
| class TestUser(TestCase): | ||
| def test_signing_up_with_invalid_email(self): | ||
| data = { | ||
| "username": "test", | ||
| "password": "Tdt4141!?@abc", | ||
| "password1": "Tdt4141!?@abc", | ||
| "email": "mail.com", | ||
| "isCoach": False, | ||
| "athletes": [], | ||
| "workouts": [], | ||
| "coach_files": [], | ||
| "athlete_files": [] | ||
| } | ||
| serializer = UserSerializer(data=data) | ||
| self.assertFalse(serializer.is_valid()) | ||
| self.assertIn('email', serializer.errors) | ||
|
|
||
| def test_password_below_minimum_length(self): | ||
| data = { | ||
| "username": "test", | ||
| "password": "Tdt4141!?@a", | ||
| "password1": "Tdt4141!?@a", | ||
| "email": "test@mail.com", | ||
| "isCoach": False, | ||
| "athletes": [], | ||
| "workouts": [], | ||
| "coach_files": [], | ||
| "athlete_files": [] | ||
| } | ||
| serializer = UserSerializer(data=data) | ||
| self.assertFalse(serializer.is_valid()) | ||
| self.assertIn('password', serializer.errors) |