def test_check_admin_add_self(self, client): self.assertTrue(pli.has_admin) # 200 => we added the role. res = post_add_role(client, PEERLEADER_ROLE, user1["_id"]) self.assertEqual(200, res.status_code) # Check that the role caching isn't broken. self.assertTrue(pli.has_editor()) self.assertEqual(PEERLEADER_ROLE, PliUser.get(user1["_id"]).role)
def test_check_non_editor_create_question_page(self, client): self.assertFalse(pli.has_editor()) # 403 => Participant cannot access page res = client.get('/surveys/questions/create') self.assertEqual(403, res.status_code)
def test_check_none(self, client): self.assertFalse(pli.has_editor()) self.assertFalse(pli.has_admin()) self.assertFalse(pli.has_peerleader()) self.assertTrue(pli.has_user())
def test_check_editor_create_question_page(self, client): self.assertTrue(pli.has_editor()) res = client.get('/surveys/questions/create') self.assertEqual(200, res.status_code)