-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6a85f22
commit e6198ea
Showing
4 changed files
with
30 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
from asgikit.responses import respond_text | ||
from selva.web import controller, get | ||
|
||
|
||
@controller | ||
class Controller: | ||
@get | ||
async def index(self, request): | ||
await respond_text(request.response, "Selva") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import sys | ||
from pathlib import Path | ||
|
||
from httpx import AsyncClient | ||
|
||
from selva.configuration.defaults import default_settings | ||
from selva.configuration.settings import Settings | ||
from selva.web.application import Selva | ||
|
||
|
||
async def test_application(): | ||
settings = Settings(default_settings | { | ||
"components": ["tests.web.application.application"] | ||
}) | ||
app = Selva(settings) | ||
|
||
client = AsyncClient(app=app) | ||
response = await client.get("http://localhost:8000/") | ||
assert response.text == "Selva" |