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):
|
2020-11-08 14:35:15 +00:00
|
|
|
client = Client()
|
|
|
|
response = client.get('/consume/')
|
2020-11-08 14:40:34 +00:00
|
|
|
self.assertTrue(b"TODO" not in response.content)
|