コード例 #1
0
 def setUp(self):
     self.client = app.test_client()
     app.config["TESTING"] = True
     app.config["SECRET_KEY"] = "ABC"
     connect_to_db(app, "postgresql:///testdb")
     db.create_all()
     example_data()
コード例 #2
0
    def setUp(self):
        self.client = app.test_client()
        app.config["TESTING"] = True
        app.config["SECRET_KEY"] = "ABC"
        connect_to_db(app, "postgresql:///testdb")
        db.create_all()
        example_data()

        with self.client as c:
            with c.session_transaction() as sess:
                sess["user_id"] = 1
コード例 #3
0
    def setUp(self):
        self.client = app.test_client()
        app.config["TESTING"] = True
        app.config["SECRET_KEY"] = "ABC"
        connect_to_db(app, "postgresql:///testdb")
        db.create_all()
        example_data()

        with self.client as c:
            with c.session_transaction() as sess:
                sess["user_id"] = 1

        def _mock_match_foundation_shade(fav_hex, foundation_hex_lst):
            return [
                "#EECDB1", "#F4D6B9", "#EFD1B3", "#E8D2BB", "#F2CCB2",
                "#EDC8B4"
            ]

        generate_hex.match_foundation_shade = _mock_match_foundation_shade

        closest_matches = Foundation.query.filter(
            Foundation.foundation_hex_code.in_(top_hex_matches)).all()