def performUserSignup(self, username, password, payment_nonce): """ Signs up the User with the given username and password. """ # First check if the user already in the database. user_login = self._fetchLoginByUsername(username) if user_login: raise Exception("User '%s' already exist.<br>" "Please contact us for more information." % username) user_login = Login(username=username) # Get the hash of the given password to store in the database. pass_hash = self._getHashedPassword(str(password)) # Create a customer object in BrainTree result = braintree.Customer.create({ "first_name": username, "last_name": "User", "payment_method_nonce": payment_nonce, "id": username, }) if not result.is_success: raise Exception("Could not create BrainTree customer") # Save the User credentials in the databae. user_login.password_hash = pass_hash user_login.urole = int(Login.Role.USER) user_login.save() return user_login
def setUp(self): self.login = Login()
def setup_class(cls): cls.model = Login() cls.model.driver = webdriver.Chrome() cls.model.driver.maximize_window() cls.model.driver.implicitly_wait(5)
def run(self): user = Login() user.username = '******' user.password_ = 'secret' db.session.add(user) db.session.commit()