The user should be able to write tests for their view app, like so:
@app.get("/")
async def index():
...
@index.test("my test name") # could also be left blank, like @index.test
async def test_index(route: view.Test):
assert (await route(query={"hello": "world"})).response == "foo"
# OR, it could be synchronous
@index.test("my test name")
def test_index(route: view.SyncTest):
assert route(...).response == "..." # manually call event loop internally
Then, the end user should be able to run their tests, like so:
$ view test
GET /hello (my test name) passed in 0.43ms
GET /fail failed after 1s:
assert route(...).response == "..."
AssertionError
They could also run tests for specific routes:
$ view test /hello --methods GET,POST
GET /hello (my test name) passed in 0.43ms
This should integrate with a virtual I/O system in #10 (i.e. database connections won't actually be called, and instead just made in memory for testing purposes)
The user should be able to write tests for their view app, like so:
Then, the end user should be able to run their tests, like so:
They could also run tests for specific routes:
This should integrate with a virtual I/O system in #10 (i.e. database connections won't actually be called, and instead just made in memory for testing purposes)