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

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

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