def test_field_validation(self): try: # max_length t = 'A' * 201 c = Case(title=t, file_number=t) c.save() raise ValueError('DataError should have been raised.') except DataError: pass
def test_case_serializable(self): # TODO >> With post processing FS file_path = os.path.join(settings.WORKING_DIR, 'serialized_case.json') a = Case(file_number='ABC/123', date=date(year=2000, month=10, day=2)) a.save() a_json = a.to_json(file_path) b = Case.from_json_file(file_path) b_json = b.to_json() # Clean up again os.remove(file_path) # Compare self.assertEqual(a_json, b_json)