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

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

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

        # Create tables and add sample data (uncomment when testing database)
        db.create_all()
        example_data()

        with self.client as c:
        with c.session_transaction() as sess:
            sess['RSVP'] = True

    def tearDown(self):
        """Do at end of every test."""

        # (uncomment when testing database)
        db.session.close()
        db.drop_all()

    def test_games(self):
        result = self.client.get("/games")
        self.assertIn("Clue", result.data)
コード例 #2
0
ファイル: tests.py プロジェクト: MadhuriHB/Testing-flask
    def setUp(self):
        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
コード例 #3
0
ファイル: tests.py プロジェクト: aninahpets/hb_testing
    def setUp(self):
        # connect_to_db(app)
        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['RSVP'] = True
コード例 #4
0
ファイル: tests.py プロジェクト: laurensila/flask-testing
    def setUp(self):
        """Stuff to do before every test."""

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

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

        db.create_all()
        example_data()
コード例 #5
0
    def setUp(self):
        """Stuff to do before every test."""

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

        # Connect to test database (uncomment when testing database)
        connect_to_db(app, "postgresql:///testdb")
        # Create tables and add sample data (uncomment when testing database)
        db.create_all()
        example_data()
コード例 #6
0
    def setUp(self):
        """Stuff 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['RSVP'] = True
        # Connect to test database (uncomment when testing database)
        connect_to_db(app, "postgresql:///testdb")

        # Create tables and add sample data (uncomment when testing database)
        db.create_all()
        example_data()
コード例 #7
0
ファイル: tests.py プロジェクト: ritzbitz77/testing-py-2
    def setUp(self):
        """Stuff 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['RSVP'] = True

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

        # Create tables and add sample data (uncomment when testing database)
        db.create_all()
        example_data()
コード例 #8
0
ファイル: tests.py プロジェクト: loopDelicious/testing-py-2
    def setUp(self):
        """Stuff to do before every test."""

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

        # adding a session variable to signify user has RSVP'd, since all tests
        # in PartyTestsDatabases class assumes user has RSVP'd
        with self.client as c:
            with c.session_transaction() as sess:
                sess['RSVP'] = True

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

        # Create tables and add sample data (uncomment when testing database)
        db.create_all()
        example_data()
コード例 #9
0
    def setUp(self):
        """Stuff to do before every test."""

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

        # The second 'with' STORES a session in the test browser
        # (so that it can be fake-logged-in)
        with self.client as c:
            with c.session_transaction() as sess:
                sess['RSVP'] = True

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

        # Create tables and add sample data (uncomment when testing database)
        db.create_all()
        example_data()
コード例 #10
0
ファイル: tests.py プロジェクト: yfalcon8/Testing_py_2
    def setUp(self):
        """Stuff to do before every test."""

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

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

        # Create tables and add sample data (uncomment when testing database)
        # Reach into model.py to call example_data() to create test db
        db.create_all()
        example_data()

        # with statement for the test client to be logged in 
        # - if theyre logged in the /games route should display games.html
        with self.client as c:
            with c.session_transaction() as sess:
                sess['RSVP'] = True
コード例 #11
0
ファイル: tests.py プロジェクト: dencynluv/testing-flask
    def setUp(self):
        """Stuff to do before every test."""

        # creating a test client that we can test. A pretend browser (headless browser)
        self.client = app.test_client()
        app.config['TESTING'] = True
        app.config['SECRET_KEY'] = "SECRETSECRETSECRET"

        # creates a fake session in our browser so test_games can run
        with self.client as c:
            with c.session_transaction() as sess:
                # creating an RSVP session from line 26 in party.py
                sess['RSVP'] = True

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

        # Create tables and add sample data (uncomment when testing database)
        db.create_all()  #opens session
        example_data()
コード例 #12
0
ファイル: tests.py プロジェクト: tien-han/Testing-Py-2
    def setUp(self):
        """Stuff to do before every test."""

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

        # reset our sample database
        # Game.query.delete()
        # db.session.commit()

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


        # Create tables and add sample data (uncomment when testing database)
        db.create_all()
        example_data("Chess", "A 2-person game of strategy.")

        with self.client as c:
            with c.session_transaction() as sess:
                sess['RSVP'] = True
コード例 #13
0
ファイル: tests.py プロジェクト: Aisling-Dempsey/testing-2
 def setUp(self):
     self.client = app.test_client()
     app.config['TESTING'] = True
コード例 #14
0
 def setUp(self):
     #  Instantiating Flask test client, and setting as instance attr.
     self.client = app.test_client()
     # Testing configuration variable for Flask, causes any Flask error t be printed to the console. For deugging.
     app.config['TESTING'] = True
コード例 #15
0
 def setUp(self):
     """Runs before the test."""
     self.client = app.test_client()
     app.config['TESTING'] = True
コード例 #16
0
ファイル: tests.py プロジェクト: whitneybelba/Flask-Testing
    def setUp(self):
        """Stuff to do before every test."""

        self.client = app.test_client()
        app.config['TESTING'] = True
コード例 #17
0
    def setUp(self):
        """Do before tests."""

        self.client = app.test_client()
        app.config['TESTING'] = True
コード例 #18
0
ファイル: tests.py プロジェクト: wfslithtaivs/Flask-Testing
 def setUp(self):
     self.client = app.test_client()  # browser simulation
     app.config['TESTING'] = True
コード例 #19
0
    def setUp(self):
        """Stuff to do before every test."""

        self.client = app.test_client()
        app.config['TESTING'] = True
コード例 #20
0
 def setUp(self):
     self.client = app.test_client()
     app.config['TESTING'] = True
     app.config['SECRET_KEY'] = 'key'
コード例 #21
0
    def setUp(self):
        self.client = app.test_client()
        app.config['TESTING'] = True

        #use the test database instead of the default during testing
        connect_to_db(app, "postgresql:///testdb")
コード例 #22
0
 def setUp(self):
     self.client = app.test_client()
     app.config['TESTING'] = True
コード例 #23
0
ファイル: tests.py プロジェクト: teganbroderick/testing-py-2
 def setUp(self):
     self.client = app.test_client(
     )  #instantiated the Flask test client here, and set it as an instance attribute, client, of the test class
     app.config[
         'TESTING'] = True  #set the TESTING configuration variable for Flask, which causes any Flask errors to be printed to the same console as the tests, helping debug errors that happen during tests.