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

Improve test coverage of chemical_inventory.models #122

Open
canismarko opened this issue Nov 3, 2018 · 0 comments
Open

Improve test coverage of chemical_inventory.models #122

canismarko opened this issue Nov 3, 2018 · 0 comments
Assignees

Comments

@canismarko
Copy link
Owner

Right now, ~70% of chemical_inventory/models.py is covered by unit tests. Let's get this a little bit higher.

Write some tests for some of the simple methods are aren't currently covered. Tests go in chemical_inventory/tests.py. For each test, the basic approach will probably be:

  1. Create a new object for a given model (eg chemical = models.Chemical(name='unobtainium'))
  2. [optional] save the new object to the database (depends on whether the method queries the database)
  3. Call the method from the object and check that the value matches what you expect.s

Here are some simple methods that would be good to start with:

  • Glove.__str__()
  • Container.is_expired()
  • Container.quantity_string()
  • Location.__str__()
  • StandardOperatingProcedure.__str__()
  • Chemical.__str__()

Some that might be a little trickier:

  • Chemical.has_expired()
  • expired_containers()
  • Container.mark_as_empty()

To see the test coverage for this file, go here

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

No branches or pull requests

2 participants