def setUp(self):
        app.config[TestKeys.TESTING] = True
        app.config[TestKeys.WTF_CSRF_ENABLED] = False
        app.config[TestKeys.DEBUG] = False
        app.config[
            TestKeys.SQLALCHEMY_DATABASE_URI] = DataBaseConfig. \
                                                    DB_DIALECT + DataBaseConfig. \
                                                    USER_NAME + ':' + DataBaseConfig. \
                                                    PASSWORD + '@' + DataBaseConfig. \
                                                    SERVER_ADDRESS + ':' + DataBaseConfig. \
                                                    PORT + '/' + DataBaseConfig. \
                                                    DATABASE_NAME
        app.register_blueprint(index_route)
        app.register_blueprint(car_owner)
        app.register_blueprint(business_owner)
        app.register_blueprint(authentication)
        app.register_blueprint(admin)
        app.register_blueprint(choose_service_grade)

        self.app = app.test_client()

        if self._testMethodName == "test_no_db":
            db.drop_all()
        else:
            db.drop_all()
            init_db()
예제 #2
0
    def setUp(self):
        app.config['TESTING'] = True
        app.config['WTF_CSRF_ENABLED'] = False
        app.config['DEBUG'] = False
        app.config[
            'SQLALCHEMY_DATABASE_URI'] = DataBaseConfig.DB_DIALECT + DataBaseConfig.USER_NAME \
                                         + ':' + DataBaseConfig.PASSWORD + '@' + DataBaseConfig.SERVER_ADDRESS \
                                         + ':' + DataBaseConfig.PORT + '/' + DataBaseConfig.DATABASE_NAME
        app.register_blueprint(authentication)
        app.register_blueprint(admin)

        app.register_blueprint(index_route)

        app.register_blueprint(business_owner)
        app.register_blueprint(authentication)
        app.register_blueprint(car_owner)
        app.register_blueprint(choose_service_grade)

        self.app = app.test_client()
        # init_db()
        # if self._testMethodName == "test_no_db":
        # db.drop_all()
        #
        db.drop_all()
        # # db.create_all()
        # else:
        #     # pass
        init_db()
예제 #3
0
    def setUp(self):
        app.config['TESTING'] = True
        app.config['WTF_CSRF_ENABLED'] = False
        app.config['DEBUG'] = False
        app.config[
            'SQLALCHEMY_DATABASE_URI'] = DataBaseConfig.generate_database_uri()
        app.register_blueprint(authentication)
        app.register_blueprint(admin)

        app.register_blueprint(index_route)

        app.register_blueprint(business_owner)
        app.register_blueprint(authentication)
        app.register_blueprint(car_owner)
        app.register_blueprint(choose_service_grade)

        self.app = app.test_client()
        if self._testMethodName == "test_no_db":
            db.drop_all()

        # db.drop_all()
        # db.create_all()
        else:
            # pass
            init_db()
    def setUp(self):
        app.config['TESTING'] = True
        app.config['WTF_CSRF_ENABLED'] = False
        app.config['DEBUG'] = False
        app.config[
            'SQLALCHEMY_DATABASE_URI'] = DataBaseConfig.generate_database_uri(
            )
        app.register_blueprint(index_route)
        app.register_blueprint(business_owner)

        self.app = app.test_client()
        init_db()
예제 #5
0
    def setUp(self):
        app.config['TESTING'] = True
        app.config['WTF_CSRF_ENABLED'] = False
        app.config['DEBUG'] = False
        app.config[
            'SQLALCHEMY_DATABASE_URI'] = DataBaseConfig.generate_database_uri(
            )
        app.register_blueprint(index_route)
        app.register_blueprint(business_owner)

        self.app = app.test_client()

        if self._testMethodName == "test_no_db":
            db.drop_all()
        elif self._testMethodName == "test_wrong_status_type":
            pass
        elif self._testMethodName == "test_overlap_in_starting_job":
            data = [
                {
                    "service_type": 3,
                    "service_grade": 1
                },
                {
                    "service_type": 4,
                    "service_grade": 1
                },
            ]
            car_problems = []
            for car_problem in data:
                c_p = CarProblem(consumable_item_id=1,
                                 services_definition_id=1)
                car_problems.append(c_p)
            status = Status.query.filter(
                Status.name == Keys.STATUS_START).first()
            job = AutoServiceJob(business_owner_id=1,
                                 car_owner_id=1,
                                 car_id=2,
                                 status_=status,
                                 start_schedule="2019-01-05 16:29:45",
                                 finish_schedule="2019-01-07 16:43",
                                 price=1236)

            job.car_problems.extend(car_problems)
            db.session.add(job)
            db.session.commit()

        else:
            init_db()
예제 #6
0
    def setUp(self):
        app.config['TESTING'] = True
        app.config['WTF_CSRF_ENABLED'] = False
        app.config['DEBUG'] = False
        app.config[
            'SQLALCHEMY_DATABASE_URI'] = DataBaseConfig.DB_DIALECT + DataBaseConfig.USER_NAME + ':' + DataBaseConfig.PASSWORD + '@' + DataBaseConfig.SERVER_ADDRESS + ':' + DataBaseConfig.PORT + '/' + DataBaseConfig.DATABASE_NAME
        app.register_blueprint(car_owner)

        self.app = app.test_client()

        # db.create_all()
        if self._testMethodName == "test_no_db":
            db.drop_all()
        else:
            pass
            init_db()
    def setUp(self):
        app.config['TESTING'] = True
        app.config['WTF_CSRF_ENABLED'] = False
        app.config['DEBUG'] = False
        app.config[
            'SQLALCHEMY_DATABASE_URI'] = DataBaseConfig.DB_DIALECT + DataBaseConfig.USER_NAME + ':' + DataBaseConfig.PASSWORD + '@' + DataBaseConfig.SERVER_ADDRESS + ':' + DataBaseConfig.PORT + '/' + DataBaseConfig.DATABASE_NAME
        app.register_blueprint(index_route)
        app.register_blueprint(authentication)
        app.register_blueprint(suppliers)

        self.app = app.test_client()
        if self._testMethodName == "test_no_db":
            db.drop_all()
        else:
            # db.drop_all()
            init_db()
예제 #8
0
    def setUp(self):
        POSTGRES = {
            'user': '******',
            'pw': 'postgres',
            'db': 'dr-autol-test',
            'host': 'localhost',
            'port': '5432',
        }
        app.config['TESTING'] = True
        app.config['WTF_CSRF_ENABLED'] = False
        app.config['DEBUG'] = False
        app.config[
            'SQLALCHEMY_DATABASE_URI'] = DataBaseConfig.DB_DIALECT + DataBaseConfig.USER_NAME + ':' + DataBaseConfig.PASSWORD + '@' + DataBaseConfig.SERVER_ADDRESS + ':' + DataBaseConfig.PORT + '/' + DataBaseConfig.DATABASE_NAME
        app.register_blueprint(index_route)
        app.register_blueprint(car_owner)
        app.register_blueprint(authentication)
        app.register_blueprint(admin)
        app.register_blueprint(choose_service_grade)

        self.app = app.test_client()

        init_db()
예제 #9
0
    def setUp(self):
        POSTGRES = {
            'user': '******',
            'pw': 'postgres',
            'db': 'dr-autol-test',
            'host': 'localhost',
            'port': '5432',
        }
        app.config['TESTING'] = True
        app.config['WTF_CSRF_ENABLED'] = False
        app.config['DEBUG'] = False
        app.config[
            'SQLALCHEMY_DATABASE_URI'] = DataBaseConfig.DB_DIALECT + DataBaseConfig.USER_NAME + ':' + DataBaseConfig.PASSWORD + '@' + DataBaseConfig.SERVER_ADDRESS + ':' + DataBaseConfig.PORT + '/' + DataBaseConfig.DATABASE_NAME
        app.register_blueprint(index_route)
        app.register_blueprint(business_owner)

        self.app = app.test_client()

        # db.create_all()
        if self._testMethodName == "test_no_db":
            db.drop_all()
        else:
            init_db()