Exemplo n.º 1
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")
Exemplo n.º 2
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())
Exemplo n.º 3
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})
Exemplo n.º 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")
Exemplo n.º 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())
Exemplo n.º 6
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})