Esempio n. 1
0
    def test_request_course_form_success(self):
        form = RequestCourseForm()
        form._errors = {}
        form.cleaned_data = {}

        form.clean()
        self.assertEquals(len(form._errors.keys()), 0)
Esempio n. 2
0
    def test_form_valid(self):
        view = RequestCourseView()
        form = RequestCourseForm()
        form.cleaned_data = {
            'name': 'Test Instructor',
            'email': '*****@*****.**',
            'uni': 'ttt123',
            'course': 'Test Course',
            'course_id': 'Test Course Id',
            'term': 'Fall',
            'year': '2014',
            'instructor': 'Test Instructor',
            'section_leader': 'Test Teachers Assistant',
            'start': datetime.now(),
            'end': datetime.now(),
            'students': 24,
            'assignments_required': True,
            'description': 'Description',
            'title': 'The Course',
            'pid': '123',
            'mid': '456',
            'type': 'action item',
            'owner': 'sdreher',
            'assigned_to': 'sdreher'
        }

        with self.settings(TASK_ASSIGNMENT_DESTINATION=None):
            view.form_valid(form)
Esempio n. 3
0
    def test_request_course_form_fail(self):
        form = RequestCourseForm()
        form._errors = {}
        form.cleaned_data = {
            'decoy': 'foo'
        }

        form.clean()
        self.assertEquals(len(form._errors.keys()), 1)
        self.assertTrue('decoy' in form._errors)