def setup_super_and_example_account(self): example_accounts = ['*****@*****.**' % i for i in range(100)] for email in [self.super_user_email_address] + example_accounts: try: EmailAndPasswordSystemAccount.by_email(email) except NoSuchAccountException: system_account = EmailAndPasswordSystemAccount(email=email) system_account.set_new_password(email, 'snakesnake') system_account.activate() Session.add(system_account)
def new_system_account(self, party=None, email='*****@*****.**', activated=True): password = '******' system_account = EmailAndPasswordSystemAccount(owner=party or self.party, email=email) system_account.set_new_password(email, password) system_account.password = password # The unencrypted version for use in tests if activated: system_account.activate() Session.add(system_account) Session.flush() return system_account
def new_account(self): account = EmailAndPasswordSystemAccount(email='*****@*****.**') Session.add(account) account.set_new_password(account.email, self.password) account.activate() return account