-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'new_data_models' into new_data_model_permissions
- Loading branch information
Showing
9 changed files
with
78 additions
and
65 deletions.
There are no files selected for viewing
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
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
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
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
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
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
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
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
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 |
---|---|---|
|
@@ -165,10 +165,44 @@ def test_constraints__last_name__indy(self): | |
with self.assert_raises_integrity_error(): | ||
User.objects.create_user( | ||
password="password", | ||
first_name="teacher", | ||
first_name="Indiana", | ||
email="[email protected]", | ||
) | ||
|
||
def test_constraints__is_staff(self): | ||
""" | ||
Students cannot be a staff user. | ||
""" | ||
|
||
with self.assert_raises_integrity_error(): | ||
User.objects.create_user( | ||
first_name="Indiana", | ||
password="password", | ||
student=Student.objects.create( | ||
auto_gen_password="password", | ||
klass=self.klass__AB123, | ||
school=self.school__1, | ||
), | ||
is_staff=True, | ||
) | ||
|
||
def test_constraints__is_superuser(self): | ||
""" | ||
Students cannot be a super user. | ||
""" | ||
|
||
with self.assert_raises_integrity_error(): | ||
User.objects.create_user( | ||
first_name="Indiana", | ||
password="password", | ||
student=Student.objects.create( | ||
auto_gen_password="password", | ||
klass=self.klass__AB123, | ||
school=self.school__1, | ||
), | ||
is_superuser=True, | ||
) | ||
|
||
def test_objects__create(self): | ||
""" | ||
Cannot call objects.create. | ||
|
@@ -263,31 +297,6 @@ def test_objects__create_superuser__teacher(self): | |
assert user.is_staff | ||
assert user.is_superuser | ||
|
||
def test_objects__create_superuser__student(self): | ||
""" | ||
Create a student super user. | ||
""" | ||
|
||
user_fields = { | ||
"first_name": "first_name", | ||
"password": "password", | ||
"student": Student.objects.create( | ||
auto_gen_password="password", | ||
klass=self.klass__AB123, | ||
school=self.school__1, | ||
), | ||
} | ||
|
||
user = User.objects.create_superuser( | ||
**user_fields # type: ignore[arg-type] | ||
) | ||
assert user.first_name == user_fields["first_name"] | ||
assert user.password != user_fields["password"] | ||
assert user.check_password(user_fields["password"]) | ||
assert user.student == user_fields["student"] | ||
assert user.is_staff | ||
assert user.is_superuser | ||
|
||
def test_objects__create_superuser__indy(self): | ||
""" | ||
Create an independent super user. | ||
|