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

Add tests for models in the core app #1

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

tony-nyagah
Copy link
Owner

@tony-nyagah tony-nyagah commented Mar 13, 2024

What does this PR do?

This PR adds tests specifically for models in the core app of this project. The functionality targeted specifically is all models in the core app.

Contributes to resolving issue: hotosm#229

Considerations

I added string representations to the models to provide an easier to read human readable value when a model instance is queried.

I also modified the .gitignore to include .venv and .env folder to avoid accidentally committing those types of files.

While writing the tests I came across a model simply named Model which seems redundant and confusing. This should be changed to a name that fits the functionality better.

I realized that there's a lot of boilerplate while writing the tests and decided to use ModelBakery to modify the tests.

Some warnings pop up when running the tests in regards to how the auto field has been used for dates. They don't stop tests or the project from running but modifications can be made to the relevant fields to remove the warning:
2024-03-13_12-44

How to test?

The test for the models in the core app can be run with python manage.py test tests.test_models_core.

- modify the dataset model with a __str__ return
- modify .gitignore by adding env folders
- add model bakery to requirements
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant