コード例 #1
0
    def test_reenable(self):
        view = LTICourseEnableView()
        ctx = LTICourseContextFactory()
        user = UserFactory()

        data = {
            'group': ctx.group.id,
            'faculty_group': ctx.faculty_group.id,
            'lti-enable': '1'
        }

        # enable the first time
        request = RequestFactory().post('/', data)
        request.user = user
        view.request = request

        view.dispatch(request)
        ctx.refresh_from_db()
        self.assertTrue(ctx.enable)
コード例 #2
0
    def test_enable(self):
        view = LTICourseEnableView()
        group = GroupFactory()
        faculty_group = GroupFactory()
        user = UserFactory()

        data = {
            'group': group.id,
            'faculty_group': faculty_group.id,
            'lti-enable': '1'
        }

        # enable the first time
        request = RequestFactory().post('/', data)
        request.user = user
        view.request = request

        response = view.dispatch(request)
        self.assertEquals(response.status_code, 302)
        ctx = LTICourseContext.objects.get(group=group,
                                           faculty_group=faculty_group)
        self.assertTrue(ctx.enable)