コード例 #1
0
ファイル: test_json_file.py プロジェクト: chevah/utils
    def test_init_good_path(self):
        """
        Everthing should be fine if initialized with a path.
        """
        path = manufacture.makeFilename()

        json_file = JSONFile(path=path)

        self.assertEqual(path, json_file.path)
        self.assertIsNone(json_file.file)
コード例 #2
0
ファイル: test_json_file.py プロジェクト: chevah/utils
    def test_load_file_io_error(self):
        """
        An UtilsError is raised for any IO/OS Error.
        """
        path = manufacture.makeFilename()
        json_file = JSONFile(path=path)

        with self.assertRaises(UtilsError) as context:
            json_file.load()

        self.assertExceptionID(u'1027', context.exception)
        self.assertExceptionData(
            {
                u'path': path,
                u'details': self.Contains(u'No such file'),
            },
            context.exception,
            )