示例#1
0
    def setUp(self):
        """Stuff to do before every test."""

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

        # Mock session

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

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


        def _mock_grab_image_dimensions(filename):
            return (920, 764)

        self._old_grab_image_dimensions = server.grab_image_dimensions
        server.grab_image_dimensions = _mock_grab_image_dimensions

        def _mock_generate_thumb(filename, crop_thumb):
            return None

        self._old_generate_thumb = server.generate_thumb
        server.generate_thumb = _mock_generate_thumb
示例#2
0
    def setUp(self):
        """Before every test"""
        self.client = app.test_client()
        app.config["TESTING"] = True

        connect_to_db(app, "postgresql:///barternet")

        db.create_all()
        sample_data()
示例#3
0
    def setUp(self):
        """Things to do before every test"""

        self.client = app.test_client()
        app.config['TESTING'] = True

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

        #create tables
        db.create_all()

        #add the sample data
        sample_data()
示例#4
0
    def setUp(self):
        """Performs this before each test."""

        self.client = app.test_client()
        app.config["TESTING"] = True
        app.config["SECRET_KEY"] = "code"

        set_user_login(self)

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

        db.create_all()

        # Put in sample data
        sample_data()
示例#5
0
    def setUp(self):
        """Things to do before every test"""

        self.client = app.test_client()
        app.config['TESTING'] = True
        app.config['SECRET_KEY'] = 'key'

        with self.client as c:
            with c.session_transaction() as sess:
                sess['user_id'] = 1
        #connect to test database
        connect_to_db(app, "postgresql:///testdb")

        #create tables
        db.create_all()

        #add the sample data
        sample_data()