dry-python / dry-python/dry-python.github.io

Database fixtures considered harmful.

Abierto
#116 0 comentarios 0 reacciones 0 asignados Ver en GitHub
blog
Lenguaje dominante
HTML
Estrellas
10
Forks
5
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

#### 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.
```python
@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.

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.