hack-house/.venv/lib/python3.12/site-packages/tests/extensions/injection/test_dependency.py
leetcrypt bb1d662ee1 chore: rename project coven → hack-house ⛧
Rebrand the Rust client crate (coven/ → hh/, package+binary "hack-house"),
README, CLI strings, and branch (coven → hack-house). Gitea repo renamed
cmd-chat → hack-house to match. Crypto/server logic unchanged; selftest +
golden-vector test still green, binary is now `hack-house`.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-05-30 13:29:14 -07:00

46 lines
919 B
Python

from sanic import Request, text
class Foo:
def bar(self):
return "foobar"
def test_dependency_added(app):
foo = Foo()
foobar = Foo()
app.ext.dependency(foo)
app.ext.dependency(foobar, name="something")
assert app.ctx._dependencies.foo is foo
assert app.ctx._dependencies.something is foobar
def test_dependency_injection(app):
foo = Foo()
app.ext.dependency(foo)
@app.get("/getfoo")
async def getfoo(request: Request, foo: Foo):
return text(foo.bar())
_, response = app.test_client.get("/getfoo")
assert response.text == "foobar"
def test_dependency_injection_head(app):
foo = Foo()
app.ext.dependency(foo)
@app.get("/getfoo")
async def getfoo(request: Request, foo: Foo):
return text(foo.bar())
_, response = app.test_client.head("/getfoo")
assert int(response.headers.get("content-length", 0)) == 6