Example #1
0
    def setUp(self):
        # set up fake test browser
        self.client = app.test_client()

        # connect to temporary database
        connect_to_db(app, "sqlite:///")

        # This line makes a 500 error in a route raise an error in a test
        app.config['TESTING'] = True

        # create tables and add sample data
        db.create_all()
        example_data_rec_areas()
        example_data_users()
        example_data_visits()
Example #2
0
    def setUp(self):
        """Stuff to do before every test."""

        # Get the Flask test client
        self.client = app.test_client()

        # Show Flask errors that happen during tests
        app.config['TESTING'] = True

        # Connect to test database
        connect_to_db(app, "postgresql:///testdb")

        # Create tables and add sample data
        db.create_all()
        example_data_users()

        # initiate a session
        with self.client.session_transaction() as session:
            session['user'] = '******'
            self.client.set_cookie('localhost', 'MYCOOKIE', 'cookie_value')
Example #3
0
    def setUp(self):
        # set up fake test browser
        self.client = app.test_client()

        # connect to temporary database
        connect_to_db(app, "sqlite:///")

        # This line makes a 500 error in a route raise an error in a test
        app.config['TESTING'] = True

        # create tables and add sample data
        db.create_all()
        example_data_rec_areas()
        example_data_users()
        example_data_visits()

        # initiate a session
        with self.client as c:
            with c.session_transaction() as sess:
                sess['user'] = '******'
            c.set_cookie('localhost', 'MYCOOKIE', 'cookie_value')
Example #4
0
    def setUp(self):
        # set up fake test browser
        self.client = app.test_client()

        # connect to temporary database
        connect_to_db(app, "sqlite:///")

        # This line makes a 500 error in a route raise an error in a test
        app.config['TESTING'] = True

        # create tables and add sample data
        db.create_all()
        example_data_rec_areas()
        example_data_users()
        example_data_visits()

        # initiate a session
        with self.client as c:
                with c.session_transaction() as sess:
                    sess['user'] = '******'
                c.set_cookie('localhost', 'MYCOOKIE', 'cookie_value')
    def setUp(self):
        """Stuff to do before every test."""

        # Get the Flask test client
        self.client = app.test_client()

        # Show Flask errors that happen during tests
        app.config['TESTING'] = True

        # Connect to test database
        connect_to_db(app, "postgresql:///testdb")

        # Create tables and add sample data
        db.create_all()
        example_data_users()


        # initiate a session
        with self.client.session_transaction() as session:
            session['user'] = '******'
            self.client.set_cookie('localhost', 'MYCOOKIE', 'cookie_value')