Ejemplo n.º 1
0
    def test_user_fullname(self):
        lti = LTI('initial', 'any')
        self.assertEquals(lti.user_fullname(), '')

        lti.lti_params = {'user_id': 'student_one'}
        self.assertEquals(lti.user_fullname(), 'student_one')

        lti.lti_params = BASE_LTI_PARAMS
        self.assertEquals(lti.user_fullname(), 'Foo Bar Baz')
Ejemplo n.º 2
0
    def test_user_fullname(self):
        lti = LTI('initial', 'any')
        self.assertEquals(lti.user_fullname(), '')

        lti.lti_params = {'user_id': 'student_one'}
        self.assertEquals(lti.user_fullname(), 'student_one')

        lti.lti_params = BASE_LTI_PARAMS
        self.assertEquals(lti.user_fullname(), 'Foo Bar Baz')
Ejemplo n.º 3
0
    def test_user_roles(self):
        lti = LTI('initial', 'any')
        self.assertEquals(lti.user_roles(), [])

        lti.lti_params = BASE_LTI_PARAMS
        self.assertEquals(lti.user_roles(), [
            u'urn:lti:instrole:ims/lis/instructor',
            u'urn:lti:instrole:ims/lis/staff'])

        self.assertTrue(lti.is_instructor())
        self.assertFalse(lti.is_administrator())
Ejemplo n.º 4
0
    def test_user_roles(self):
        lti = LTI('initial', 'any')
        self.assertEquals(lti.user_roles(), [])

        lti.lti_params = BASE_LTI_PARAMS
        self.assertEquals(lti.user_roles(), [
            u'urn:lti:instrole:ims/lis/instructor',
            u'urn:lti:instrole:ims/lis/staff'
        ])

        self.assertTrue(lti.is_instructor())
        self.assertFalse(lti.is_administrator())
Ejemplo n.º 5
0
    def test_custom_course_context(self):
        lti = LTI('initial', 'any')

        with self.assertRaises(KeyError):
            lti.custom_course_context()

        lti.lti_params = BASE_LTI_PARAMS
        lti.lti_params['custom_course_context'] = 434
        with self.assertRaises(LTICourseContext.DoesNotExist):
            lti.custom_course_context()

        ctx = LTICourseContextFactory()
        lti.lti_params['custom_course_context'] = 'abc'
        with self.assertRaises(ValueError):
            lti.custom_course_context()

        lti.lti_params['custom_course_context'] = ctx.uuid
        with self.assertRaises(LTICourseContext.DoesNotExist):
            lti.custom_course_context()

        ctx.enable = True
        ctx.save()
        self.assertEquals(lti.custom_course_context(), ctx)
Ejemplo n.º 6
0
    def test_user_email(self):
        lti = LTI('initial', 'any')
        self.assertIsNone(lti.user_email())

        lti.lti_params = BASE_LTI_PARAMS
        self.assertEquals(lti.user_email(), '*****@*****.**')
Ejemplo n.º 7
0
    def test_consumer_user_id(self):
        lti = LTI('initial', 'any')
        lti.lti_params = BASE_LTI_PARAMS.copy()
        lti.lti_params['oauth_consumer_key'] = '1234567890'

        self.assertEquals(lti.consumer_user_id(), '1234567890-student')
Ejemplo n.º 8
0
    def test_user_email(self):
        lti = LTI('initial', 'any')
        self.assertIsNone(lti.user_email())

        lti.lti_params = BASE_LTI_PARAMS
        self.assertEquals(lti.user_email(), '*****@*****.**')
Ejemplo n.º 9
0
    def test_consumer_user_id(self):
        lti = LTI('initial', 'any')
        lti.lti_params = BASE_LTI_PARAMS.copy()
        lti.lti_params['oauth_consumer_key'] = '1234567890'

        self.assertEquals(lti.consumer_user_id(), '1234567890-student')
Ejemplo n.º 10
0
    def test_user_roles(self):
        lti = LTI('initial', 'any')
        self.assertEquals(lti.user_roles(), [])

        lti.lti_params = BASE_LTI_PARAMS
        self.assertEquals(lti.user_roles(), ['Instructor', 'Staff'])