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)
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, )