예제 #1
0
 def test_get_roles(self):
     """Create a role for a user, then get it"""
     expected_role = CourseAccessRoleFactory.create(
         course_id=self.course.id, user=self.user, role="SuperCoolTestRole",
     )
     roles = data.get_user_roles(self.user.username)
     self.assertEqual(roles, {expected_role})
예제 #2
0
 def test_get_roles_invalid_user(self):
     """Get roles for a user that doesn't exist"""
     with pytest.raises(UserNotFoundError):
         data.get_user_roles("i_dont_exist_and_should_raise_an_error")
예제 #3
0
 def test_get_roles_no_roles(self):
     """Get roles for a user who has no roles"""
     roles = data.get_user_roles(self.user.username)
     assert roles == set()
예제 #4
0
 def test_get_roles_invalid_user(self):
     """Get roles for a user that doesn't exist"""
     with pytest.raises(UserNotFoundError):
         data.get_user_roles("i_dont_exist_and_should_raise_an_error")
예제 #5
0
 def test_get_roles_no_roles(self):
     """Get roles for a user who has no roles"""
     roles = data.get_user_roles(self.user.username)
     self.assertEqual(roles, set())