Example #1
0
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
Example #2
0
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
Example #3
0
 def setUp(self):
     app.config['WTF_CSRF_ENABLED'] = False
     self.app = app.test_client()
Example #4
0
def test_index():
    tester = app.test_client()
    response = tester.get('/', content_type='html/text')

    assert response.status_code == 200
Example #5
0
def client():
    BASE_DIR = Path(__file__).resolve().parent.parent
    app.config["TESTING"] = True

    yield app.test_client()
Example #6
0
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!"
Example #7
0
 def setUp(self):
     app.config['WTF_CSRF_ENABLED'] = False
     self.app = app.test_client()
Example #8
0
def client():
    return app.test_client()