astrosat / django-astrosat-users

Common backend library for Astrosat projects' user management
GNU General Public License v3.0
2 stars 0 forks source link

Minimize code duplication in tests #81

Open marksmall opened 4 years ago

marksmall commented 4 years ago

Describe the bug

Look to reduce the amount of code duplication between tests. Most of it is very similar, least the setting up of the test, with a few tweaks here and there. We should look to find the common code and factor that out into re-usable functions or other sensible way.

marksmall commented 4 years ago

Comment from allyn: Maybe a fixture that takes a user and returns a client w/ that user already authenticated?

Just to be clear, this means a @pytest.fixture, not a fixture file of data to be loaded.

We have pytest fixtures dotted around our code-bases, here is an example of one that takes parameters: https://github.com/astrosat/orbis/blob/ec4c888bc8c999ca1bd59e49908eed1dd16b8bc8/server/orbis/tests/conftest.py#L31