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

TestClient should expose app attribute #2891

Closed
thomaszdxsn opened this issue Mar 29, 2018 · 5 comments
Closed

TestClient should expose app attribute #2891

thomaszdxsn opened this issue Mar 29, 2018 · 5 comments
Labels

Comments

@thomaszdxsn
Copy link
Contributor

Long story short

I wrote my first test today, use pytest-aiohttp, fixture: aiohttp_client.

I don't want to follow doc by use hardcode URL, I think it is not a good practical pattern. I want to use app.route[].url_for().

And I found it need long access chain. like cli.server.app.route[].url_for().with_query().

Maybe should expose app attribute/property in TestClient instance?

Expected behaviour

can access app in client by client.app.

Actual behaviour

must access client.server.app

@asvetlov
Copy link
Member

I not sure.
The test client could be used for testing low-level server (https://docs.aiohttp.org/en/stable/web_lowlevel.html) where .app is not exist.

We can assign cli.app to None in this case but the behavior should be properly tested and documented.
If you want to make a fix for it -- you are welcome but please don't forget about low-level server testing.

@thomaszdxsn
Copy link
Contributor Author

thomaszdxsn commented Mar 30, 2018

I will fix it on weekend

@asvetlov
Copy link
Member

Cool!

@asvetlov
Copy link
Member

asvetlov commented Apr 2, 2018

Fixed by #2901

@asvetlov asvetlov closed this as completed Apr 2, 2018
@lock
Copy link

lock bot commented Oct 28, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a [new issue] for related bugs.
If you feel like there's important points made in this discussion, please include those exceprts into that [new issue].
[new issue]: https://github.com/aio-libs/aiohttp/issues/new

@lock lock bot added the outdated label Oct 28, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Oct 28, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants