Files
2017-09-29 00:05:17 +03:00

41 lines
1.2 KiB
Python

"""File containing Infoscreen tests."""
from django.test import TestCase, Client
from infoscreen.models import Rotation
from infoscreen.models import SossoInfoItem
from django.http import HttpRequest
import infoscreen.views
import logging
class InfoscreenTestCase(TestCase):
"""Test cases for testing infoscreen methods."""
def setUp(self):
"""Create some dummy models."""
Rotation.objects.create(name="test_rot")
SossoInfoItem.objects.create()
self.c = Client()
def test_rotation_created(self):
"""Check if the dummy model actually exists."""
rot = Rotation.objects.get(name="test_rot")
self.assertIsNotNone(rot)
def test_sosso_infoitem_created(self):
"""Check if the dummy model actually exists."""
item = SossoInfoItem.objects.get()
self.assertIsNotNone(item)
def test_get_infoitems(self):
"""
Check if infoItems returns a response with non-zero content length.
That would mean that something meaningful has been included
in the response.
"""
resp = self.c.get('/infoscreen/items')
content = resp.json()
self.assertTrue(len(content) > 0)