Skip to content
Snippets Groups Projects
Commit a34886de authored by Piotr Gawron's avatar Piotr Gawron
Browse files

unit tests for object to string methods for Holiday, Room, Item, Subject classes

parent 0f781328
No related branches found
No related tags found
1 merge request!100Test coverage unit tests
import logging
from django.test import TestCase
from web.models import Holiday
from web.tests import create_worker
logger = logging.getLogger(__name__)
class HolidayTests(TestCase):
def test_str(self):
holiday = Holiday(person=create_worker())
self.assertIsNotNone(str(holiday))
self.assertIsNotNone(unicode(holiday))
import logging
from django.test import TestCase
from web.models import Item
logger = logging.getLogger(__name__)
class ItemTests(TestCase):
def test_str(self):
item = Item(name="test item")
self.assertIsNotNone(str(item))
self.assertIsNotNone(unicode(item))
import logging
from django.test import TestCase
from web.models import Room
logger = logging.getLogger(__name__)
class RoomTests(TestCase):
def test_str(self):
room = Room(room_number=4, address="some street 2/3", city="Luxembourg")
self.assertIsNotNone(str(room))
self.assertIsNotNone(unicode(room))
from django.test import TestCase
from web.models import Appointment
from web.models import Visit
from web.tests.functions import create_study_subject, create_appointment
from web.tests.functions import create_visit
from web.models import Appointment, Visit
from web.tests.functions import create_study_subject, create_appointment, create_subject, create_visit
class SubjectModelTests(TestCase):
......@@ -20,3 +18,9 @@ class SubjectModelTests(TestCase):
self.assertTrue(subject.dead)
self.assertTrue(visit_finished)
self.assertEquals(Appointment.APPOINTMENT_STATUS_CANCELLED, appointment_status)
def test_str(self):
subject = create_subject()
self.assertIsNotNone(str(subject))
self.assertIsNotNone(unicode(subject))
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment