-
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.
Merge branch 'development' into permissions_cleanup
- Loading branch information
Showing
207 changed files
with
19,399 additions
and
1,293 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
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 |
---|---|---|
|
@@ -811,26 +811,137 @@ def test_create_project(self): | |
"archived": False, | ||
"days": 50, | ||
"deadline": timezone.now() + timezone.timedelta(days=50), | ||
"start_date": timezone.now() | ||
"start_date": timezone.now(), | ||
"group_size": 2 | ||
}, | ||
follow=True, | ||
) | ||
|
||
self.assertEqual(response.status_code, 200) | ||
self.assertTrue(course.projects.filter(name="become champions").exists()) | ||
|
||
# Make sure there are no groups automatically made | ||
project = course.projects.get(name="become champions") | ||
self.assertEqual(project.groups.count(), 0) | ||
|
||
def test_create_project_with_number_groups(self): | ||
""" | ||
Able to create a project for a course with a number of groups. | ||
""" | ||
course = get_course() | ||
course.teachers.add(self.user) | ||
|
||
response = self.client.post( | ||
reverse("course-projects", args=[str(course.id)]), | ||
data={ | ||
"name": "become champions", | ||
"description": "win the jpl", | ||
"visible": True, | ||
"archived": False, | ||
"days": 50, | ||
"deadline": timezone.now() + timezone.timedelta(days=50), | ||
"start_date": timezone.now(), | ||
"number_groups": 5 | ||
}, | ||
follow=True, | ||
) | ||
|
||
self.assertEqual(response.status_code, 200) | ||
self.assertTrue(course.projects.filter(name="become champions").exists()) | ||
|
||
# Make sure the groups are created | ||
project = course.projects.get(name="become champions") | ||
self.assertEqual(project.groups.count(), 5) | ||
|
||
def test_create_individual_project(self): | ||
""" | ||
Able to create an individual project for a course. | ||
""" | ||
course = get_course() | ||
course.teachers.add(self.user) | ||
|
||
# Create some students | ||
student1 = create_student(id=5, first_name="Simon", last_name="Mignolet", email="[email protected]") | ||
student2 = create_student(id=6, first_name="Ronny", last_name="Deila", email="[email protected]") | ||
student3 = create_student(id=7, first_name="Karel", last_name="Geraerts", email="[email protected]") | ||
|
||
# Add the students to the course | ||
course.students.add(student1) | ||
course.students.add(student2) | ||
course.students.add(student3) | ||
|
||
response = self.client.post( | ||
reverse("course-projects", args=[str(course.id)]), | ||
data={ | ||
"name": "become champions", | ||
"description": "win the jpl", | ||
"visible": True, | ||
"archived": False, | ||
"days": 50, | ||
"deadline": timezone.now() + timezone.timedelta(days=50), | ||
"start_date": timezone.now(), | ||
"group_size": 1 | ||
}, | ||
follow=True, | ||
) | ||
|
||
self.assertEqual(response.status_code, 200) | ||
self.assertTrue(course.projects.filter(name="become champions").exists()) | ||
|
||
# Make sure the groups are created | ||
project = course.projects.get(name="become champions") | ||
self.assertEqual(project.groups.count(), 3) | ||
|
||
for group in project.groups.all(): | ||
self.assertEqual(group.students.count(), 1) | ||
|
||
def test_clone_course(self): | ||
""" | ||
Able to clone a course. | ||
""" | ||
course = get_course() | ||
course.teachers.add(self.user) | ||
|
||
# Create an assistant and add it to the course | ||
assistant = get_assistant() | ||
course.assistants.add(assistant) | ||
|
||
response = self.client.post( | ||
reverse("course-clone", args=[str(course.id)]), | ||
data={"clone_assistants": False}, | ||
follow=True, | ||
) | ||
|
||
self.assertEqual(response.status_code, 200) | ||
self.assertTrue(Course.objects.filter(name=course.name, | ||
academic_startyear=course.academic_startyear + 1).exists()) | ||
|
||
# Make sure there are no assistants in the cloned course | ||
cloned_course = Course.objects.get(name=course.name, academic_startyear=course.academic_startyear + 1) | ||
self.assertFalse(cloned_course.assistants.exists()) | ||
|
||
def test_clone_with_assistants(self): | ||
""" | ||
Able to clone a course with assistants. | ||
""" | ||
course = get_course() | ||
course.teachers.add(self.user) | ||
|
||
# Create an assistant and add it to the course | ||
assistant = get_assistant() | ||
course.assistants.add(assistant) | ||
|
||
# Clone the course with the assistants | ||
response = self.client.post( | ||
reverse("course-clone", args=[str(course.id)]), | ||
data={"clone_assistants": True}, | ||
follow=True, | ||
) | ||
|
||
self.assertEqual(response.status_code, 200) | ||
self.assertTrue(Course.objects.filter(name=course.name, | ||
academic_startyear=course.academic_startyear + 1).exists()) | ||
|
||
# Make sure the assistant is also cloned | ||
cloned_course = Course.objects.get(name=course.name, academic_startyear=course.academic_startyear + 1) | ||
self.assertTrue(cloned_course.assistants.filter(id=assistant.id).exists()) |
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
Oops, something went wrong.