def testGetProfiles(self): self.assertRaises(ActionException, get_profiles, None) self.assertEqual(len(get_profiles('a')), 0) setCurrentUser("*****@*****.**", "Administrator") register_new_user('Admin') logoutCurrentUser() setCurrentUser("*****@*****.**", "User1") register_new_user('User1') logoutCurrentUser() self.assertEqual(len(get_profiles('a')), 1) self.assertEqual(len(get_profiles('u')), 1) self.assertEqual(len(get_profiles('A')), 1) self.assertEqual(len(get_profiles('U')), 1)
def testManySignups(self): setCurrentUser("*****@*****.**", "Administrator") self.assertRaises(NoUserNameException, _get_my_profile) register_new_user('SiteAdmin') logoutCurrentUser() setCurrentUser("*****@*****.**", "NewUser1") self.assertRaises(NoUserNameException, _get_my_profile) register_new_user('NewUserOne') logoutCurrentUser() setCurrentUser("*****@*****.**", "NewUser2") self.assertRaises(NoUserNameException, _get_my_profile) register_new_user('NewUserTwo') logoutCurrentUser() setCurrentUser("*****@*****.**", "NewUser3") self.assertRaises(NoUserNameException, _get_my_profile) register_new_user('NewUserThree') logoutCurrentUser() setCurrentUser("*****@*****.**", "AnotherUser1") self.assertRaises(NoUserNameException, _get_my_profile) register_new_user('AnotherUserOne') logoutCurrentUser() setCurrentUser("*****@*****.**", "AnotherUser2") self.assertRaises(NoUserNameException, _get_my_profile) register_new_user('AnotherUserTwo') logoutCurrentUser() setCurrentUser("*****@*****.**", "AnotherUser3") self.assertRaises(NoUserNameException, _get_my_profile) register_new_user('AnotherUserThree') self.assertEqual(len(get_profiles("Another")), 3) self.assertEqual(len(get_profiles("another")), 3) self.assertEqual(len(get_profiles("new")), 3)