def setUp(self): SkygearContainer.set_default_app_name(self.app_name) with db.conn() as conn: conn.execute("CREATE SCHEMA IF NOT EXISTS app_{0}" .format(self.app_name)) conn.execute(""" CREATE TABLE IF NOT EXISTS _user ( id text PRIMARY KEY, username text, email text, password text, auth jsonb );""") sql = text(""" INSERT INTO _user (id, username, password) VALUES (:id, :username, :password); """) conn.execute(sql, id='1', username='******', password=u.hash_password('supersecret1'))
def setUp(self): SkygearContainer.set_default_app_name(self.app_name) with db.conn() as conn: conn.execute("CREATE SCHEMA IF NOT EXISTS app_{0}".format( self.app_name)) conn.execute(""" CREATE TABLE IF NOT EXISTS _user ( id text PRIMARY KEY, username text, email text, password text, auth jsonb );""") sql = text(""" INSERT INTO _user (id, username, password) VALUES (:id, :username, :password); """) conn.execute(sql, id='1', username='******', password=u.hash_password('supersecret1'))
def test_hash_password(self): hashed = u.hash_password(PLAINTEXT) assert isinstance(hashed, str) assert_correct_pw(PLAINTEXT, hashed)