Example #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)
Example #2
0
    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
Example #3
0
    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
Example #4
0
    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()
    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()
    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()
Example #7
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()
Example #8
0
    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()
Example #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()
Example #10
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)
        # 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
Example #11
0
    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()
Example #12
0
    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
Example #13
0
 def setUp(self):
     self.client = app.test_client()
     app.config['TESTING'] = True
Example #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
Example #15
0
 def setUp(self):
     """Runs before the test."""
     self.client = app.test_client()
     app.config['TESTING'] = True
Example #16
0
    def setUp(self):
        """Stuff to do before every test."""

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

        self.client = app.test_client()
        app.config['TESTING'] = True
Example #18
0
 def setUp(self):
     self.client = app.test_client()  # browser simulation
     app.config['TESTING'] = True
Example #19
0
    def setUp(self):
        """Stuff to do before every test."""

        self.client = app.test_client()
        app.config['TESTING'] = True
Example #20
0
 def setUp(self):
     self.client = app.test_client()
     app.config['TESTING'] = True
     app.config['SECRET_KEY'] = 'key'
Example #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")
Example #22
0
 def setUp(self):
     self.client = app.test_client()
     app.config['TESTING'] = True
Example #23
0
 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.