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

Database fixtures considered harmful. #116

Open
proofit404 opened this issue Jul 1, 2019 · 0 comments
Open

Database fixtures considered harmful. #116

proofit404 opened this issue Jul 1, 2019 · 0 comments
Labels

Comments

@proofit404
Copy link
Contributor

An article about better test fixtures

  • dependencies can turn stories business objects into pytest fixtures.
  • We will write better tests because our database fills up logic does not duplicate in FactoryBoy.
  • @value decorator can be used to return normal results from the factories.
@register
class SubmitCodeFixture(SubmitCode):

    name = 'submit_code'

    @value
    def fixture(submit_code, user, token):
        return submit_code(user, token)

    user = require('request_code')

    token = Faker('uuid')
  • profit: Tests coupled with business logic will fail if this logic changes. On the other side, we'll need to change each FactoryBoy usage in our test suite to mirror actual behavior.
@proofit404 proofit404 changed the title [Blog] Database fixtures considered harmful. Database fixtures considered harmful. Jul 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

1 participant