Пример #1
0
 def testGetMyRoles(self):
     setupLotsOfRoles()
     setCurrentUser("*****@*****.**", "User1")
     roles_list = get_my_roles()
     self.assertEqual(len(roles_list), 15)
     setCurrentUser("*****@*****.**", "User2")
     roles_list = get_my_roles()
     self.assertEqual(len(roles_list), 3)
Пример #2
0
 def testSetPlaying(self):
     setCurrentUser("*****@*****.**", "User1")
     register_new_user('User1')
     role1 = create_role("Test Role 1")
     role2 = create_role("Test Role 2")
     set_playing(role1)
     self.assertEqual(get_my_roles()[0]["name"], "Test Role 1")
     set_playing(role2)
     self.assertEqual(get_my_roles()[1]["name"], "Test Role 2")
     set_playing(None)
     self.assertEqual(get_my_roles()[2]["name"], "User1")
Пример #3
0
 def testWritableProperty(self):
     setCurrentUser("*****@*****.**", "User1")
     register_new_user('User1')
     create_role("Role 1")
     myroles1 = get_my_roles()
     self.assertTrue(myroles1[0].get("writable"))
     self.assertTrue(myroles1[1].get("writable"))
     place1 = create_place("Place 1")
     create_presence(myroles1[1]["id"], place1)
     logoutCurrentUser()
     setCurrentUser("*****@*****.**", "User2")
     register_new_user('User2')
     create_role("Role 2")
     myroles2 = get_my_roles()
     self.assertTrue(myroles2[0].get("writable"))
     self.assertTrue(myroles2[1].get("writable"))
     myroles3 = get_roles_in_place(place1)
     self.assertFalse(myroles3[0].get("writable"))
Пример #4
0
 def testDeleteAnotherUsersRole(self):
     setCurrentUser("*****@*****.**", "User1")
     register_new_user('User1')
     role1url = create_role("Test Role 1")
     logoutCurrentUser()
     setCurrentUser("*****@*****.**", "User2")
     register_new_user('User2')
     self.assertEquals(len(get_my_roles()), 1)
     self.assertRaises(DataModelException, delete_place, role1url)
Пример #5
0
 def testSaveRoleName(self):
     setCurrentUser("*****@*****.**", "User1")
     register_new_user('User1')
     roleid = create_role("Test Role 1")
     save_role(roleid, "New Role name")
     self.assertEqual(get_my_roles()[0]["name"], "New Role name")