Esempio n. 1
0
 def testFirstSignup(self):
     setCurrentUser("*****@*****.**", "Administrator")
     '''Should fail repeatedly with a NoUserNameException'''
     self.assertRaises(NoUserNameException, _get_my_profile)
     self.assertRaises(NoUserNameException, _get_my_profile)
     '''Should create the Site Administrator with its own place for template Roles'''
     register_new_user('SiteAdmin')
     '''Should have a SiteAdmin now'''
     self.assertIsInstance(_get_my_profile(), SiteMasterProfile)
     self.assertEquals(SiteMasterProfile.query().count(), 1)
     self.assertEquals(Profile.query().count(), 1)
     '''Should be called whatever it was set up as'''
     self.assertEquals('SiteAdmin', get_my_profile_name())
     '''Check number of entities'''
     self.assertEquals(1, SiteMasterProfile.query().count())
     '''Should just fail with a NoUserException if logged out'''
     logoutCurrentUser()
     self.assertRaises(NoUserException, _get_my_profile)
Esempio n. 2
0
 def testNextSignup(self):
     setCurrentUser("*****@*****.**", "Administrator")
     self.assertRaises(NoUserNameException, _get_my_profile)
     self.assertRaises(NoUserNameException, _get_my_profile)
     register_new_user('SiteAdmin')
     self.assertIsInstance(_get_my_profile(), Profile)
     self.assertEquals('SiteAdmin', get_my_profile_name())
     self.assertEquals(1, SiteMasterProfile.query().count())
     self.assertEquals(1, Profile.query().count())
     logoutCurrentUser()
     self.assertRaises(NoUserException, _get_my_profile)
     setCurrentUser("*****@*****.**", "NewUser1")
     self.assertRaises(NoUserNameException, _get_my_profile)
     self.assertRaises(NoUserNameException, _get_my_profile)
     '''Should create a GameMaster for this new profile with its own Place for private conversations'''
     register_new_user('NewUserOne')
     '''Should have an profile now'''
     self.assertIsInstance(_get_my_profile(), Profile)
     '''Should be called whatever it was set up as'''
     self.assertEquals('NewUserOne', get_my_profile_name())
     self.assertEquals(2, Profile.query().count())
     logoutCurrentUser()
     self.assertRaises(NoUserException, _get_my_profile)
Esempio n. 3
0
def _get_site_master():
    sml = SiteMasterProfile.query().fetch(1)
    return sml[0] if len(sml) > 0 else None