Esempio n. 1
0
 def setUp(self):
     with APP.app_context():
         APP.config['TESTING'] = True
         APP.config['WTF_CSRF_ENABLED'] = False
         APP.config['DEBUG'] = False
         APP.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///test.db'
         self.APP = APP.test_client()
         DB.init_app(APP)
         DB.drop_all()
         DB.create_all()
     self.assertEqual(APP.debug, False)
Esempio n. 2
0
def test_socketio():

    APP.config['WTF_CSRF_ENABLED'] = False

    flask_test_client = APP.test_client()

    socketio_test_client = socketio.test_client(
        APP, flask_test_client=flask_test_client)

    assert socketio_test_client.is_connected()

    r = flask_test_client.post('/', data={
        'email': '*****@*****.**', 'password': '******'})
    assert r.status_code == 307

    socketio_test_client = socketio.test_client(
        APP, flask_test_client=flask_test_client)

    socketio_test_client.send({'room': 'room1', 'data': 'This is a test'})
    r = socketio_test_client.get_received()

    assert len(r) == 1
    message = r[0].get('args').get('data')
    assert message == 'This is a test'
Esempio n. 3
0
 def setUp(self):
     self.APP = APP.test_client()
     self.APP.testing = True
Esempio n. 4
0
def client():
    APP.config['TESTING'] = True
    APP.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False

    with APP.test_client() as client:
        yield client
Esempio n. 5
0
def client():
    client = APP.test_client()

    yield client