예제 #1
0
    def test_case_serializable(self):
        # TODO >> With post processing FS
        f = os.path.join(RESOURCE_DIR, 'serialized_case.json')

        a = Case(file_number='ABC/123', date=date(year=2000, month=10, day=2))
        a_json = a.to_json(f)

        b = Case.from_json_file(f)
        b_json = b.to_json()

        self.assertEqual(a_json, b_json)
예제 #2
0
    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)