vinissimus / async-asgi-testclient

A framework-agnostic library for testing ASGI web applications
MIT License
160 stars 20 forks source link

Allow overriding the scheme used in websocket_connect to support wss #48

Closed shevron closed 2 years ago

shevron commented 2 years ago

This is my fix for #47. It allows passing scheme= to a websocket connection. I also took the liberty of passing any arguments to websocket_connect down to the WebSocketSession constructor, similar to how all the other get, post etc. method just pass arguments to open.

Happy to fix if there is any feedback.

codecov-commenter commented 2 years ago

Codecov Report

Merging #48 (9821cb8) into master (0e92f98) will increase coverage by 0.03%. The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #48      +/-   ##
==========================================
+ Coverage   87.53%   87.56%   +0.03%     
==========================================
  Files           6        6              
  Lines         409      410       +1     
==========================================
+ Hits          358      359       +1     
  Misses         51       51              
Impacted Files Coverage Δ
async_asgi_testclient/testing.py 89.04% <100.00%> (ø)
async_asgi_testclient/websocket.py 74.41% <100.00%> (+0.30%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 0e92f98...9821cb8. Read the comment docs.

shevron commented 2 years ago

Note that the formatting changes are caused by running the latest black (couldn't get the version specified in test-requirements.txt to run with Python 3.9.9). I ran it because otherwise Travis wouldn't pass.

masipcat commented 2 years ago

Thank you for your contribution! Right now I'm on holidays so I'll do the release when I come back (in a couple of weeks)