Example #1
0
def test_init_app_does_not_register_blueprint_if_docs_are_disabled(
        server_info: Info, faker: Faker):
    spec = AsyncApiSpec(
        asyncapi=faker.pystr(),
        info=server_info,
        channels={},
    )
    server = AsynctionSocketIO(spec, True, False, [], None, None)
    app = Flask(__name__)
    server.init_app(app)
    assert "asynction_docs" not in app.blueprints
Example #2
0
def test_init_app_does_not_register_handlers_if_app_is_none(
        server_info: Info, faker: Faker):
    namespace = f"/{faker.pystr()}"
    event_name = faker.pystr()
    spec = AsyncApiSpec(
        asyncapi=faker.pystr(),
        info=server_info,
        channels={
            namespace:
            Channel(publish=Operation(message=OneOfMessages(one_of=[
                Message(
                    name=event_name,
                    payload={"type": "object"},
                    x_handler="tests.fixtures.handlers.ping",
                )
            ]), ))
        },
    )
    server = AsynctionSocketIO(spec, False, False, [], None, None)
    server.init_app(app=None)
    assert not server.handlers