im/inventory/tests.py

26 lines
766 B
Python
Raw Normal View History

2018-09-16 10:35:02 +00:00
from django.test import TestCase
2020-11-08 14:20:52 +00:00
from django.test import Client
2018-09-16 10:35:02 +00:00
2020-11-08 14:20:52 +00:00
from inventory.models import PantryItem, Category
class PantryItemTestCase(TestCase):
""" simple test case for a model"""
def setUp(self):
cat = Category.objects.create(name="UNCATEGORIZED")
PantryItem.objects.create(name="testitem", category=cat)
def test_pantryitem_looksok(self):
"""Pantryitems to string is ok"""
testitem = PantryItem.objects.get(name="testitem")
self.assertEqual(str(testitem), 'testitem')
class InterFaceTestCase(TestCase):
"""Simple test case for the web interface"""
def test_consume_view_exists(self):
c = Client()
response = c.get('/consume/')
self.assertTrue("TODO" not in response)