def test_get_readable_number_segments(self): obj = SecurityGenerator().generate() obj.number_segments = u'[1,2,4-10, {}]' result = self.serializer.get_readable_number_segments(obj) self.assertNotIn('[', result) self.assertNotIn(']', result) self.assertNotIn('u', result) self.assertNotIn('{', result) self.assertNotIn('}', result)
def test_fields(self): security = SecurityGenerator().generate() self.assertTrue(hasattr(security, 'track_numbers')) self.assertTrue(hasattr(security, 'face_value')) self.assertTrue(hasattr(security, 'number_segments')) segments = [1, 2, 3, '4-6'] security.number_segments = segments security.save() # refresh from db s = Security.objects.get(id=security.id) self.assertEqual(s.number_segments, segments)