def test_non_lti_user_returns_none(self): non_edx_user = UserFactory.create() non_edx_user.save() user = users.LtiBackend().authenticate( username=non_edx_user.username, ) self.assertIsNone(user)
def test_missing_user_returns_none(self): user = users.LtiBackend().authenticate( username=self.edx_user.username, lti_user_id='Invalid Username', lti_consumer=self.lti_consumer ) self.assertIsNone(user)
def test_valid_user_authenticates(self): user = users.LtiBackend().authenticate( username=self.edx_user.username, lti_user_id=self.lti_user_id, lti_consumer=self.lti_consumer ) self.assertEqual(user, self.edx_user)
def test_missing_lti_consumer_returns_null(self): user = users.LtiBackend().authenticate( self.request, username=self.edx_user.username, lti_user_id=self.lti_user_id, ) self.assertIsNone(user)
def test_get_user_returns_none_for_invalid_user(self): user = users.LtiBackend().get_user(-1) self.assertIsNone(user)
def test_existing_user_returned_by_get_user(self): user = users.LtiBackend().get_user(self.edx_user.id) self.assertEqual(user, self.edx_user)