def setUp(self): db.create_all() self.admin_user = UserModel( name=test_admin_user["name"], email=test_admin_user["email"], username=test_admin_user["username"], password=test_admin_user["password"], terms_and_conditions_checked=test_admin_user[ "terms_and_conditions_checked"], ) db.session.add(self.admin_user) db.session.commit() self.admin_user.is_email_verified = True
def setUp(self): db.create_all() self.first_user = UserModel( name=user1["name"], email=user1["email"], username=user1["username"], password=user1["password"], terms_and_conditions_checked=user1["terms_and_conditions_checked"], ) self.second_user = UserModel( name=user2["name"], email=user2["email"], username=user2["username"], password=user2["password"], terms_and_conditions_checked=user2["terms_and_conditions_checked"], ) self.notes_example = "description of a good mentorship relation" now_datetime = datetime.now() self.start_date_example = datetime(year=now_datetime.year + 1, month=3, day=1).timestamp() self.end_date_example = datetime(year=now_datetime.year + 1, month=5, day=1).timestamp() self.now_datetime = datetime.now().timestamp() db.session.add(self.first_user) db.session.add(self.second_user) db.session.commit() self.mentorship_relation = MentorshipRelationModel( action_user_id=self.first_user.id, mentor_user=self.first_user, mentee_user=self.second_user, creation_date=self.now_datetime, end_date=self.end_date_example, state=MentorshipRelationState.PENDING, notes=self.notes_example, tasks_list=TasksListModel(), ) db.session.add(self.mentorship_relation) db.session.commit()
def create_tables(): db.create_all()
def create_tables(): from app.database.sqlalchemy_extension import db db.create_all()
def reset_database(): db.drop_all() db.create_all()