def test_message_create_no_urgency_selected(self): message_id = 0 timestamp = datetime.datetime.now() message_text = 'Hello, tenant' urgency = '' sent_to = 'Room1 the Tester' sent_by = 'manager' has_read = False message = Message(message_id=message_id,pub_date=timestamp,message_text=message_text,urgency=urgency, sent_to=sent_to,sent_by=sent_by,has_read=has_read) message.save() self.assertFalse(Message.objects.get(message_id = message_id))
def test_message_create_recipient_not_in_database(self): message_id = 0 timestamp = datetime.datetime.now() message_text = 'Hello, tenant' urgency = 1 sent_to = 'djfnjsd' sent_by = 'manager' has_read = False message = Message(message_id=message_id,pub_date=timestamp,message_text=message_text,urgency=urgency, sent_to=sent_to,sent_by=sent_by,has_read=has_read) message.save() self.assertFalse(Message.objects.get(message_id = message_id))
def test_message_create(self): message_id = 0 timestamp = datetime.datetime.now() message_text = 'Hello, tenant' urgency = 1 sent_to = 'Room1 the Tester' sent_by = 'manager' has_read = False message = Message(message_id=message_id,pub_date=timestamp,message_text=message_text,urgency=urgency, sent_to=sent_to,sent_by=sent_by,has_read=has_read) message.save() testMessage = Message.objects.get(message_id = message_id) self.assertTrue(testMessage.message_id==message_id) self.assertTrue(testMessage.message_text==message_text) self.assertTrue(testMessage.urgency==urgency) self.assertTrue(testMessage.sent_to==sent_to) self.assertTrue(testMessage.sent_by==sent_by) self.assertTrue(testMessage.has_read==has_read)