Exemplo n.º 1
0
    def setUpClass(cls):
        cls.db_file_handle, cls.db_path = tempfile.mkstemp()

        cls.app = achiever.create_app({
            'TESTING': True,
            'DATABASE': cls.db_path,
        })

        with cls.app.app_context():
            database.init()
Exemplo n.º 2
0
    def setUp(self):
        # create tempory database tile
        self.db_file_handle, self.db_path = tempfile.mkstemp()

        self.app = achiever.create_app({
            'TESTING': True,
            'DATABASE': self.db_path,
        })

        # populate database with testing info
        with self.app.app_context():
            database.init()
Exemplo n.º 3
0
    def setUpClass(cls):
        cls.db_file_handle, cls.db_path = tempfile.mkstemp()

        cls.app = achiever.create_app({
            'TESTING': True,
            'DATABASE': cls.db_path,
            'PRESERVE_CONTEXT_ON_EXCEPTION': False,
        })

        with cls.app.app_context():
            # populate the database
            database.init()
Exemplo n.º 4
0
    def setUpClass(cls):
        # create app, temporary file
        cls.db_file_handle, cls.db_path = tempfile.mkstemp()

        cls.app = achiever.create_app({
            'TESTING': True,
            'DATABASE': cls.db_path,
        })

        # populate database
        with cls.app.app_context():
            database.init()
            user = user_q.get_by_username("test_user")

        # test user id
        cls.TEST_USER = user["user_id"]
Exemplo n.º 5
0
    def setUp(self):

        # prepare testing variables
        self.NEW_STAFF_DATA = {
            "first_name": "Ted",
            "last_name": "George",
            "cert": "RBT",
            "tier": 1,
            "color": 3,
            "supervisor": 1,
            "attendance": {
                "mon": 1,
                "tue": 1,
                "wed": 1,
                "thu": 1,
                "fri": 0,
            },
            "clients": ["AS", "LS"],
            "hours": {
                "mon": "08:00-18:00",
                "tue": "08:00-18:00",
                "wed": "08:00-18:00",
                "thu": "08:00-18:00",
                "fri": "08:00-18:00",
            },
        }
        self.TEST_STAFF_ID = 1
        self.TEST_SUPERVISOR_ID = 1
        self.CLIENT1_INITIALS = "AS"
        self.CLIENT1_ID = 2
        self.CLIENT2_INITIALS = "LS"
        self.CLIENT2_ID = 1

        # create app and database
        self.db_file_handle, self.db_path = tempfile.mkstemp()

        self.app = achiever.create_app({
            'TESTING': True,
            'DATABASE': self.db_path,
        })

        with self.app.app_context():
            # populate database
            database.init()
Exemplo n.º 6
0
    def setUpClass(cls):
        cls.db_file_handle, cls.db_path = tempfile.mkstemp()

        cls.app = achiever.create_app({
            'TESTING': True,
            'DATABASE': cls.db_path,
        })

        with cls.app.app_context():
            # populate database
            database.init()

            # insert second client
            db = database.connect()
            db.execute(
                "INSERT INTO clients "
                "(initials, total_hours, supervisor, color, mon, tue, wed, thu, fri) "
                "VALUES ('DV', '15', '1', '2', '1', '1', '1', '0', '1')"
            )

            db.commit()
            database.close()