Closed aviramha closed 4 years ago
Merging #21 into master will increase coverage by
0.09%
. The diff coverage is100%
.
@@ Coverage Diff @@
## master #21 +/- ##
==========================================
+ Coverage 83.77% 83.87% +0.09%
==========================================
Files 5 5
Lines 339 341 +2
==========================================
+ Hits 284 286 +2
Misses 55 55
Impacted Files | Coverage Δ | |
---|---|---|
async_asgi_testclient/testing.py | 86.75% <100%> (+0.17%) |
: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 5f9df31...09cfb39. Read the comment docs.
Hi, thank you for your PR!
I'd prefer to make this optional ("client": None
by default, to avoid confusion), and make it customizable in the TestClient constructor. Something like:
class TestClient:
def __init__(self, ..., scope_client: Optional[List] = None):
self.scope_client = scope_client
and then use the self.scope_client
in the scope.
FastAPI/Starlette always has this value (so I assume it's more comfortable), but I don't mind making this optional :)
I noticed that there are more scope stuff missing, so I made this more robust. Please tell me what you think
Released 1.2.1
FastAPI provides the key client in the scope for accessing ip,port tuple of the request origin. I lacked it for my tests, so added and think it might be usable for someone else.
P.S: Great repo, exactly what I lacked :)