def setUp(self): self.app = initialize_app('testing') self.app_context = self.app.app_context() self.app_context.push() db.create_all() User.new('z2333334', 'password', 'Staff') self.client = self.app.test_client(use_cookies=True)
def setUp(self): self.app = initialize_app('testing') self.app_context = self.app.app_context() self.app_context.push() db.create_all() course_id = Course.new('COMP1531', '17s2') Survey.new(course_id, "test survey", datetime(2016, 10, 20, 0, 0), datetime(2016, 10, 21, 0, 0))
def setUp(self): """Executed before each test. Define test variables and initialize app.""" self.app = create_app(TestingConfig) self.client = self.app.test_client self.ticket = {"event_id": 2, "price": 500, "quantity": 50} self.update_ticket = {"event_id": 2, "price": 500, "quantity": 10} with self.app.app_context(): db.create_all() initialize_db()
def setUp(self): """Executed before each test. Define test variables and initialize app.""" self.app = create_app(TestingConfig) self.client = self.app.test_client self.event_t = { "name": "Python Tech", "description": "Event for python developers all over the world" } with self.app.app_context(): db.create_all() initialize_db()
def setUp(self): """Executed before each test. Define test variables and initialize app.""" self.app = create_app(TestingConfig) self.client = self.app.test_client self.user = { "email": "*****@*****.**", "firstname": "Yeku Wilfred", "lastname": "chetat", "phone": "671357962", "password": "******" } with self.app.app_context(): # create all tables db.create_all() initialize_db()
def setUp(self): """Executed before each test. Define test variables and initialize app.""" self.app = create_app(TestingConfig) self.client = self.app.test_client self.event = { "title": "Markup Start", "description": "This is an event I am creating fo\ r meeting with friends", "start_datetime": "2020-05-30 15:45", "location": "Douala Bonamoussadi", "event_type_id": 1, "image_url": "https://img.nen/j.png", "organizer_id": 1 } with self.app.app_context(): db.create_all() initialize_db()
def setUp(self): self.app = initialize_app('testing') self.app_context = self.app.app_context() self.app_context.push() db.create_all() Question.new('Gne', "test question")
def setUp(self): self.app = initialize_app('testing') self.app_context = self.app.app_context() self.app_context.push() db.create_all()
""" https://flask-sqlalchemy.palletsprojects.com/en/2.x/quickstart/ """ class User(sa.Model, UserMixin): id = sa.Column(sa.Integer, primary_key=True) username = sa.Column(sa.String(80), unique=True, nullable=False) email = sa.Column(sa.String(120), unique=True) password_hash = sa.Column(sa.String(100)) first_name = sa.Column(sa.String(80)) last_name = sa.Column(sa.String(80)) def set_password(self, password): self.password_hash = generate_password_hash(password) def check_password(self, password): return check_password_hash(self.password_hash, password) def __repr__(self): return '<User %r>' % self.username @lm.user_loader def load_user(user_id): return User.query.get(int(user_id)) sa.create_all()