def test_bad_secret(): with env(GHIA_CONFIG=config_env): app = _test_app() rv = app.post('/', json=PING, headers={ 'X-Hub-Signature': 'sha1=1cacacc4207bdd4a51a7528bd9a5b9d6546b0c22', 'X-GitHub-Event': 'ping' }) assert rv.status_code >= 400
def test_ping_pongs(): with env(GHIA_CONFIG=config_env): app = _test_app() rv = app.post('/', json=PING, headers={ 'X-Hub-Signature': 'sha1=d00e131ec9215b2a349ea1541e01e1a84ac38d8e', 'X-GitHub-Event': 'ping' }) assert rv.status_code == 200
def test_dangerous_ping_pong(): with env(GHIA_CONFIG=config_env_nosecret): app = _test_app() rv = app.post('/', json=PING, headers={'X-GitHub-Event': 'ping'}) assert rv.status_code == 200
def test_app_get_has_username(): with env(GHIA_CONFIG=config_env): app = _test_app() assert user in app.get('/').get_data(as_text=True)
def test_app_imports(): with env(GHIA_CONFIG=config_env): app = _import_app() assert isinstance(app, flask.Flask)