def client(): BASE_DIR = Path(__file__).resolve().parent.parent app.config['TESTING'] = True app.config['DATABASE'] = BASE_DIR.joinpath(TEST_DB) init_db() #setup yield app.test_client() #tests get run here init_db() #teardown
def client(): BASE_DIR = Path(__file__).resolve().parent.parent app.config["TESTING"] = True app.config["DATABASE"] = BASE_DIR.joinpath(TEST_DB) app.config["SQLALCHEMY_DATABASE_URI"] = f"sqlite:///{BASE_DIR.joinpath(TEST_DB)}" db.create_all() # setup yield app.test_client() # tests run here db.drop_all() # teardown
def setUp(self): app.config['WTF_CSRF_ENABLED'] = False self.app = app.test_client()
def test_index(): tester = app.test_client() response = tester.get('/', content_type='html/text') assert response.status_code == 200
def client(): BASE_DIR = Path(__file__).resolve().parent.parent app.config["TESTING"] = True yield app.test_client()
def test_index(): tester = app.test_client() response = tester.get("/", content_type="html/text") assert response.status_code == 200 assert response.data == b"Hello, World!"
def setUp(self): app.config['WTF_CSRF_ENABLED'] = False self.app = app.test_client()
def client(): return app.test_client()