-
Notifications
You must be signed in to change notification settings - Fork 83
/
test_assignment.py
52 lines (37 loc) · 1.46 KB
/
test_assignment.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import datetime
import json
from server.models import db, Assignment, Backup, Course, User, Version
from server.utils import encode_id
from server.forms import VersionForm
from tests import OkTestCase
class TestAssignment(OkTestCase):
def setUp(self):
super().setUp()
self.setup_course()
def test_new_assignment(self):
self.login(self.admin.email)
data = {
"display_name": "test",
"name": "{}/test".format(self.course.offering),
"due_date": "2016-09-14 23:59:59",
"lock_date": "2016-09-15 23:59:59",
"max_group_size": 1,
"visible": True
}
response = self.client.post("admin/course/1/assignments/new",
data=data, follow_redirects=True)
self.assert200(response)
self.assert_template_used('staff/course/assignment/assignment.template.html')
def test_new_assignment_not_visible(self):
self.login(self.admin.email)
data = {
"display_name": "test",
"name": "{}/test".format(self.course.offering),
"due_date": "2016-09-14 23:59:59",
"lock_date": "2016-09-15 23:59:59",
"max_group_size": 1
}
response = self.client.post("admin/course/1/assignments/new",
data=data, follow_redirects=True)
self.assert200(response)
self.assertTemplateUsed('staff/course/assignment/assignments.html')