-
Notifications
You must be signed in to change notification settings - Fork 24
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
Showing
1 changed file
with
35 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -71,13 +71,20 @@ def _login_student(self): | |
password="Password1", | ||
) | ||
|
||
def _login_indy_student(self): | ||
return self.login_indy_student( | ||
email="[email protected]", | ||
password="Password1", | ||
) | ||
|
||
""" | ||
Retrieve naming convention: | ||
test_retrieve__{user_type}__{same_school} | ||
user_type: The type of user that is making the request. Options: | ||
- teacher: A teacher. | ||
- student: A school student. | ||
- indy_student: A non-school student. | ||
same_school: A flag for if the school is the same school that the user | ||
is in. Options: | ||
|
@@ -97,6 +104,21 @@ def _retrieve_school( | |
status_code_assertion, | ||
) | ||
|
||
def test_retrieve__indy_student(self): | ||
""" | ||
Independent student can not retrieve any school. | ||
""" | ||
|
||
self._login_indy_student() | ||
|
||
school = School.objects.first() | ||
assert school | ||
|
||
self._retrieve_school( | ||
school, | ||
status_code_assertion=status.HTTP_403_FORBIDDEN, | ||
) | ||
|
||
def test_retrieve__teacher__same_school(self): | ||
""" | ||
Teacher can retrieve the same school they are in. | ||
|
@@ -154,6 +176,7 @@ def test_retrieve__student__not_same_school(self): | |
user_type: The type of user that is making the request. Options: | ||
- teacher: A teacher. | ||
- student: A school student. | ||
- indy_student: A non-school student. | ||
""" | ||
|
||
def _list_schools( | ||
|
@@ -168,6 +191,18 @@ def _list_schools( | |
status_code_assertion, | ||
) | ||
|
||
def test_list__indy_student(self): | ||
""" | ||
Independent student can not list any schools. | ||
""" | ||
|
||
self._login_indy_student() | ||
|
||
self._list_schools( | ||
[], | ||
status_code_assertion=status.HTTP_403_FORBIDDEN, | ||
) | ||
|
||
def test_list__teacher(self): | ||
""" | ||
Teacher can list only the school they are in. | ||
|