From 5fd2933d2e54a7b5781698a670abf89b1031db44 Mon Sep 17 00:00:00 2001 From: Max Romanov Date: Tue, 10 Nov 2020 22:27:08 +0300 Subject: Python: supporting ASGI legacy protocol. Introducing manual protocol selection for 'universal' apps and frameworks. --- test/test_asgi_application.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'test/test_asgi_application.py') diff --git a/test/test_asgi_application.py b/test/test_asgi_application.py index 2e73e529..e90d78bc 100644 --- a/test/test_asgi_application.py +++ b/test/test_asgi_application.py @@ -418,3 +418,29 @@ Connection: close sock.close() assert len(socks) == len(threads), 'threads differs' + + def test_asgi_application_legacy(self): + self.load('legacy') + + resp = self.get( + headers={ + 'Host': 'localhost', + 'Content-Length': '0', + 'Connection': 'close', + }, + ) + + assert resp['status'] == 200, 'status' + + def test_asgi_application_legacy_force(self): + self.load('legacy_force', protocol='asgi') + + resp = self.get( + headers={ + 'Host': 'localhost', + 'Content-Length': '0', + 'Connection': 'close', + }, + ) + + assert resp['status'] == 200, 'status' -- cgit