def test_will_update_from_public_fields(self): a = {'invitation': 4, 'pfx': 'Mr', 'first': ' mitchell', 'last': 'stoutin ', 'plusOne': 1, 'orderer': 0} b = EventGuest(event=self.ev, **a) b.save() a['first'] = 'Daylen' a['event'] = self.ev.pk c = GuestPublicSerializer(b, data=a) self.assertTrue(c.is_valid()) c.save() self.assertEqual(b.first, 'Daylen')
def test_guest_public_hides_attendance(self): c = GuestPublicSerializer(self.b) self.assertFalse('status' in c.data.keys())
def test_can_save_from_public_fields(self): a = {'invitation': 4, 'pfx': None, 'first': ' mitchell', 'last': 'stoutin ', 'plusOne': 1, 'orderer': 0, 'event': self.ev.pk,} b = GuestPublicSerializer(data=a) self.assertTrue(b.is_valid()) b.save() #should throw exception invalid at model level.