Exemplo n.º 1
0
    def setUp(self):
        """Stuff to do before every test."""

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

        # Show Flask errors that happen during tests
        app.config['TESTING'] = True
        app.config['DEBUG_TB_INTERCEPT_REDIRECTS'] = False

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

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

        # User 1 is logged in
        with self.client as c:
            with c.session_transaction() as sess:
                sess['user_id'] = 1

        server.get_recipes = _mock_get_recipes

        server.get_recipe_by_id = _mock_get_recipe_by_id
Exemplo n.º 2
0
 def setUp(self):
     """Stuff to do before every test."""
     # Get the Flask test client
     self.client = app.test_client()
     # Show Flask errors that happen during tests
     app.config['TESTING'] = True
     # Connect to test database
     connect_to_db(app, "postgresql:///project")
     # Create tables and add sample data
     db.create_all()
     example_data()
Exemplo n.º 3
0
 def setUp(self):
     """Stuff to do before every test."""
     # Get the Flask test client
     self.client = app.test_client()
     # Show Flask errors that happen during tests
     app.config['TESTING'] = True
     # Connect to test database
     connect_to_db(app, "postgresql:///project")
     # Create tables and add sample data
     db.create_all()
     example_data()
     result = self.client.post("/login", data={'login_email': '*****@*****.**', 
                                               'login_password': '******'},
                                         follow_redirects=True)
Exemplo n.º 4
0
 def setUp(self):
     """Stuff to do before every test."""
     # Get the Flask test client
     self.client = app.test_client()
     # Show Flask errors that happen during tests
     app.config['TESTING'] = True
     # Connect to test database
     connect_to_db(app, "postgresql:///project")
     # Create tables and add sample data
     db.create_all()
     example_data()
     result = self.client.post("/register",
                               data={'email': "*****@*****.**", 
                                     'password': "******",
                                     'fname': "Ada", 
                                     'lname':"Hackbright",
                                     'phone': "1234567890"}, 
                               follow_redirects=True)
Exemplo n.º 5
0
    def setUp(self):
        """Stuff to do before every test."""

        # Get the Flask test client
        self.client = app.test_client()
        app.config['TESTING'] = True
        app.config['DEBUG_TB_INTERCEPT_REDIRECTS'] = False

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

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

        with self.client as c:
            with c.session_transaction() as sess:
                sess['user_id'] = 1
Exemplo n.º 6
0
    def setUp(self):
        """Run code before every test"""

        # Get the Flask test client
        app.config['TESTING'] = True
        self.client = app.test_client()

        # Connect to test database
        os.system('dropdb testdbmelonnews')
        os.system('createdb testdbmelonnews')

        connect_to_db(app, "postgresql:///testdbmelonnews")
        db.create_all()

        Comment.query.delete()
        News.query.delete()
        User.query.delete()
        Category.query.delete()
        External_News.query.delete()

        example_data()
Exemplo n.º 7
0
    def setUp(self):
        """Stuff to do before every test."""

        # Get the Flask test client
        self.client = app.test_client()
        with self.client as c:
            with c.session_transaction() as session:
                session["user_id"] = 1
                session["email"] = "*****@*****.**"
                session["first_name"] = "Jane"
                session["last_name"] = "Doe"

        # Show Flask errors that happen during tests
        app.config["TESTING"] = True

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

        # Create tables and add sample data
        db.create_all()
        example_data()
        example_data_favs()
Exemplo n.º 8
0
from main import db
from seed import example_data


if __name__ == '__main__':
    print('Creating all database tables...')
    db.drop_all()
    db.create_all()
    example_data()
    print('Done!')
# [END all]