Exemplo n.º 1
0
def insert_new_user(login,pw,shipName=""):
  """
    This used during the create new user process
    saves a new user to the database
    
    args:
      login: 
        unique email address supplied by the user
      pw: 
        password supplied by the user. 
      shipName: 
        The space ship name is supplied by the user. 
        Not required but lame if not there.
    returns:
      a tuple containing the primary key of the newly inserted user from the
      User table, the primary key of the account created for the new user,
      and the primary key of the hero created for the new user.
  """
  from Account import Account
  from Hero import Hero

  if is_login_taken(login):
    raise FileExistsError("That email is already taken")
  loginPk = safe_insert_new_user(login,pw)
  accountId = Account.create_new_account_in_db(loginPk)
  heroId = Hero.construct_new_hero_in_db(accountId,shipName)
  return (loginPk,accountId,heroId)
 def test_get_heroPk_by_accountPk(self):
   from Account import Account
   from Hero import Hero
   pk = dbHelp.create_login_using_test_values()
   accntPk = Account.create_new_account_in_db(pk)
   hPk = Hero.construct_new_hero_in_db(accntPk)
   rPk = auth.get_heroPk_by_accountPk(accntPk)
   self.assertEqual(hPk,rPk)
 def test_get_accountPk_by_loginPk(self):
   from Account import Account
   pk = dbHelp.create_login_using_test_values()
   accntPk = Account.create_new_account_in_db(pk)
   rPk = auth.get_accountPk_by_loginPk(pk)
   self.assertEqual(accntPk,rPk)
def create_test_account_using_default_values(loginPk=None):
  from Account import Account
  accountPk = Account.create_new_account_in_db(loginPk)
  return accountPk
Exemplo n.º 5
0
def create_test_account_using_default_values(loginPk=None):
    from Account import Account
    accountPk = Account.create_new_account_in_db(loginPk)
    return accountPk