Tests for demo polls app
gyermolenko opened this issue · 3 comments
gyermolenko commented
I would like to update/fix tests for demo polls app.
Let's start with simplest test scenarios:
- get 'index' view (can be done with or wo test client)
- post:
- count choices for question 1 (smth like
res = await conn.execute(choice.count())
) - post vote
- recount choices (assert is it +1)
- count choices for question 1 (smth like
But there are a couple of questions I need to clarify first.
- pytest (or pytest and unittest comparison)?
- DB initialization: setup/teardown, install.sh or migration
- do we need db fixture?
Could anyone with experience in testing async code share his view or examples I can look at? Thanks.
asvetlov commented
pytest-asyncio
please- Migration would be nice but we don't have migrations
- Yes, sure. In my dream the fixture should run Postgres in docker as we do for
aiopg
. No need for different PG server versions, the latest tag would be fine.
For examples you could just look on aiohttp test suite, files with functional
in file name.
gyermolenko commented
trying to take care of this issue in #9
gyermolenko commented
fixed in #9