Skip to content
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

fix(testing): .websocket_connect does not respect base_url #3567

Merged
merged 2 commits into from
Jun 13, 2024

Conversation

provinzkraut
Copy link
Member

@provinzkraut provinzkraut commented Jun 13, 2024

Fix a bug that caused the .websocket_connect methods on TestClient and AsyncTestClient to not respect the base_url set in the client's constructor, and instead would use the static ws://testerver URL as a base.

Also removes most of the test client code as it was unneeded and in the way of this fix :)


Explanation for the last part: All the extra code we had was just proxying method calls to the httpx.Client / httpx.AsyncClient, while altering the base URL. Since we already set the base URL on the httpx Client's superclass instance, which in turn does this merging internally, this step isn't needed at all.

@provinzkraut provinzkraut force-pushed the test-client-request branch from 2546b8c to 292658a Compare June 13, 2024 18:50
Copy link
Member

@cofin cofin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link

codecov bot commented Jun 13, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.27%. Comparing base (67bed49) to head (292658a).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3567      +/-   ##
==========================================
- Coverage   98.28%   98.27%   -0.01%     
==========================================
  Files         328      328              
  Lines       14859    14819      -40     
  Branches     2362     2361       -1     
==========================================
- Hits        14604    14564      -40     
  Misses        116      116              
  Partials      139      139              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link

Copy link

Documentation preview will be available shortly at https://litestar-org.github.io/litestar-docs-preview/3567

@provinzkraut provinzkraut merged commit 95951db into main Jun 13, 2024
26 checks passed
@provinzkraut provinzkraut deleted the test-client-request branch June 13, 2024 18:57
provinzkraut added a commit that referenced this pull request Jun 21, 2024
* Fix WS client base url

(cherry picked from commit 95951db)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants