import unittest

from factory import create_app
from extensions import db


class MyTest(unittest.TestCase):
    def setUp(self):
        sqlite_in_memory_uri = 'sqlite://'
        config = {'SQLALCHEMY_DATABASE_URI': sqlite_in_memory_uri,
                  'TESTING': True}
        app = create_app(config)
        self.app = app.test_client()  # type: Flask.flask
        with app.app_context():
            db.create_all()

    def tearDown(self):
        pass

    def test_index(self):
        rv = self.app.get('/about.html')
        assert b'about_page' in rv.data


if __name__ == '__main__':
    unittest.main()

import unittest

from factory import create_app
from extensions import db


class MyTest(unittest.TestCase):
    def setUp(self):
        sqlite_in_memory_uri = 'sqlite://'
        config = {'SQLALCHEMY_DATABASE_URI': sqlite_in_memory_uri,
                  'TESTING': True}
        app = create_app(config)
        self.app = app.test_client()  # type: Flask.flask
        with app.app_context():
            db.create_all()

    def tearDown(self):
        pass

    def test_index(self):
        rv = self.app.get('/')
        assert b'home_page' in rv.data

        rv = self.app.get('/about.html')
        assert b'about_page' in rv.data

        rv = self.app.get('/music.html')
        assert b'music_page' in rv.data

        rv = self.app.get('/projects.html')
        assert b'projects_page' in rv.data

        rv = self.app.get('/login')
        assert b'login_page' in rv.data


if __name__ == '__main__':
    unittest.main()

test main pages