Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tests for permissions and more #37

Merged
merged 16 commits into from
Jul 30, 2019
Merged

Tests for permissions and more #37

merged 16 commits into from
Jul 30, 2019

Conversation

ccrisan
Copy link
Member

@ccrisan ccrisan commented Jul 24, 2019

No description provided.

@ccrisan ccrisan requested a review from lucifurtun July 24, 2019 20:44
tests/unit/fixtures.py Show resolved Hide resolved
tests/unit/fixtures.py Show resolved Hide resolved
db.connect()
db.create_tables(MODELS)
def database(database_maker):
return database_maker(models=MODELS)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need this database_maker to be a fixture?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Technically speaking, we don't need anything to be fixture-decorated but since that's the recommended pytest way, why not following it?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't know pytest recommends this way. I actually don't see why we should have a fixture if it's not used as a fixture (for tests).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On a second (third actually) thought, I think it's best that we keep it as a fixture. Reasons are:

  1. Its friend, http_client_maker() follows the same pattern and it must be a fixture so that it receives the aiohttp_client fixture injection.
  2. We shouldn't force testers to always create an intermediate fixture so that they can use database_maker. It should be usable directly as a fixture itself, being invoked as a db factory inside the test.

tests/unit/views/test_model_view.py Outdated Show resolved Hide resolved
@ccrisan ccrisan merged commit bdf73e0 into master Jul 30, 2019
@ccrisan ccrisan deleted the tests-permissions-and-more branch July 30, 2019 18:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants