Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async def test():
config = Config(app=app, lifespan="auto")
lifespan = LifespanOn(config)
await lifespan.startup()
assert lifespan.error_occured
assert not lifespan.should_exit
await lifespan.shutdown()
async def test():
config = Config(app=app, lifespan="on")
lifespan = LifespanOn(config)
assert not startup_complete
assert not shutdown_complete
await lifespan.startup()
assert startup_complete
assert not shutdown_complete
await lifespan.shutdown()
assert startup_complete
assert shutdown_complete
async def test():
config = Config(app=app, lifespan="on")
lifespan = LifespanOn(config)
await lifespan.startup()
assert lifespan.error_occured
assert lifespan.should_exit
await lifespan.shutdown()
async def test():
config = Config(app=app, lifespan="auto")
lifespan = LifespanOn(config)
assert not startup_complete
assert not shutdown_complete
await lifespan.startup()
assert startup_complete
assert not shutdown_complete
await lifespan.shutdown()
assert startup_complete
assert shutdown_complete
)
else:
self.ssl = None
encoded_headers = [
(key.lower().encode("latin1"), value.encode("latin1"))
for key, value in self.headers
]
self.encoded_headers = (
encoded_headers if b"server" in dict(encoded_headers) else
[(b"server", b"Emmett")] + encoded_headers
)
self.http_protocol_class = self.http
self.ws_protocol_class = self.ws
self.lifespan_class = LifespanOn
self.loaded_app = self.app
self.interface = "asgi3"
self.loaded = True