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

Test/feedbackLabel-model #9

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

Conversation

nifedara
Copy link
Owner

@nifedara nifedara commented Apr 2, 2024

What does this PR do?

Completed backend model test case 🎉

Consideration?

  • In the Factory file(factories.py), I didn't include the fields that are null to simplify the data factory
  • I also didn't add the date fields as they will be created automatically
  • I added setUp class in the Test class to be able to reuse one instance of all the needed factories
  • Although some might suggest not testing a model that doesn't have a return statement, I added tests for it as it is nice to have
  • I used Black formatter
  • I didn't add coverage and factory_boy to the requirement file. So to check coverage and to use factory_boy, you have to install them yourself:
    • pip install coverage and pip install factory_boy

How to test?

  • Clone this repo
  • Follow the installation guide
  • run docker exec -it api bash to run the following commands in the container:
    • coverage run --omit='*/usr/*' manage.py test tests.test_login_model
    • or just coverage run manage.py test tests.test_core_model
    • coverage report (to see a report of the test coverage)

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.

1 participant