-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add tests for ASGI specification compliance #50
base: master
Are you sure you want to change the base?
Commits on Dec 29, 2021
-
Add tests for ASGI specification compliance
There are a number of tests that currently xfail in this suite. The intention is to fix the issues one by one, or in cases where the issue is a WONTFIX, change the test and/or indicate as such in the xfail reason. There is still a need for a couple more tests in the websocket section, and probably could do with some more type-oriented negative tests (e.g. testing what happens if you send a message with the wrong type in the event values, like with 'status')
Configuration menu - View commit details
-
Copy full SHA for 0610b93 - Browse repository at this point
Copy the full SHA 0610b93View commit details -
Allow http.response.body event with no 'body' key
Fixes test_http:test_response_body_can_be_missing()
Configuration menu - View commit details
-
Copy full SHA for b5f4d74 - Browse repository at this point
Copy the full SHA b5f4d74View commit details -
Allow http.response.start event with no 'headers' key
Fixes test_http:test_response_headers_can_be_missing()
Configuration menu - View commit details
-
Copy full SHA for dbe96c4 - Browse repository at this point
Copy the full SHA dbe96c4View commit details -
Ensure websocket events include 'asgi' in scope
Fixes test_websocket : test_asgi_version_is_present_in_websocket_scope() and test_websocket_spec_version_is_missing_or_correct()
Configuration menu - View commit details
-
Copy full SHA for f655b85 - Browse repository at this point
Copy the full SHA f655b85View commit details -
Disable lifespan protocol if apps do not support it
Fixes test_lifespan:test_lifespan_not_supported_is_allowed() This fix was somewhat challenging to achieve without breaking other things or backward compatibility issues. In the end, I think the most elegant solution is to adopt more Pythonic exceptions in the TestClient, as demonstrated in the commit. However, since this is a less trivial change, I have only used TestClientError in the lifespan related code, leaving all other code using raw Exceptions still. I think TestClientError (or possibly even multiple exception classes for different purposes) should actually be adopted throughout all the code, albeit with the caveat that it might cause some issues if anyone is doing really rigid exception assertions in their test code. For most cases (including my own code that is already using async_asgi_testclient) I believe the average 'with pytest.raises(Exception)' assertions should still work, since TestClientError is a sub-class of Exception. A side-benefit of the TestClientError is it would allow access to the original Message structure, instead of having to decode a string repr of the event message.
Configuration menu - View commit details
-
Copy full SHA for 3ff2e15 - Browse repository at this point
Copy the full SHA 3ff2e15View commit details -
Removed test for contamination between calls with a custom scope. Probably deserves documentation because it could be a gotcha for people, but it doesn't deserve to be in this test suite.
Configuration menu - View commit details
-
Copy full SHA for 732b1e6 - Browse repository at this point
Copy the full SHA 732b1e6View commit details -
Had a few issues with formatting and the black version, this commit cleans that up.
Configuration menu - View commit details
-
Copy full SHA for 2037ec9 - Browse repository at this point
Copy the full SHA 2037ec9View commit details
Commits on Jun 2, 2023
-
Configuration menu - View commit details
-
Copy full SHA for b6f93cd - Browse repository at this point
Copy the full SHA b6f93cdView commit details -
Notify the user if lifespan protocol raised an exception
Re: https://github.com/vinissimus/async-asgi-testclient/pull/50/files#r785889284 The asserts where we access the log message in the test is a bit rough, it could probably be refactored to be a little cleaner.
Configuration menu - View commit details
-
Copy full SHA for 3f79e78 - Browse repository at this point
Copy the full SHA 3f79e78View commit details -
Configuration menu - View commit details
-
Copy full SHA for cbb6100 - Browse repository at this point
Copy the full SHA cbb6100View commit details