def test_pubsubify_excs(fake_import: model.Import, client_with_modifiable_routes: flask.testing.FlaskClient):
    client = client_with_modifiable_routes
    with session_ctx() as sess:
        new_import = fake_import
        sess.add(new_import)
        sess.commit()

    @pubsubify_excs
    def ise_exc() -> flask.Response:
        raise exceptions.ISvcException('a bad happened', imports=[new_import])
    client.application.add_url_rule('/test_pubsubify_excs', view_func=ise_exc, methods=['GET'])
    resp = client.get('/test_pubsubify_excs')
    assert (resp.status_code == 202)
    with session_ctx() as sess:
        recovered_import: Import = Import.get(new_import.id, sess)
        assert (recovered_import.status == model.ImportStatus.Error)
        assert (recovered_import.error_message == 'a bad happened')
def test_pubsubify_excs(fake_import: model.Import, client_with_modifiable_routes: flask.testing.FlaskClient):
    client = client_with_modifiable_routes
    with session_ctx() as sess:
        new_import = fake_import
        sess.add(new_import)
        sess.commit()

    @pubsubify_excs
    def ise_exc() -> flask.Response:
        raise exceptions.ISvcException('a bad happened', imports=[new_import])
    client.application.add_url_rule('/test_pubsubify_excs', view_func=ise_exc, methods=['GET'])
    resp = client.get('/test_pubsubify_excs')
    assert (resp.status_code == 202)
    with session_ctx() as sess:
        recovered_import: Import = Import.get(new_import.id, sess)
        assert (recovered_import.status == model.ImportStatus.Error)
        assert (recovered_import.error_message == 'a bad happened')