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)
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
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
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()
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()
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()
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
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()
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
def setUp(self): self.client = app.test_client() app.config['TESTING'] = True
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
def setUp(self): """Runs before the test.""" self.client = app.test_client() app.config['TESTING'] = True
def setUp(self): """Stuff to do before every test.""" self.client = app.test_client() app.config['TESTING'] = True
def setUp(self): """Do before tests.""" self.client = app.test_client() app.config['TESTING'] = True
def setUp(self): self.client = app.test_client() # browser simulation app.config['TESTING'] = True
def setUp(self): self.client = app.test_client() app.config['TESTING'] = True app.config['SECRET_KEY'] = 'key'
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")
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.