def test_success(self): """Assert the method returns a path when a config file is found.""" with mock.patch.object(xdg.BaseDirectory, 'load_config_paths') as lcp: lcp.return_value = ('an_iterable', 'of_xdg', 'config_paths') with mock.patch.object(os.path, 'isfile') as isfile: isfile.return_value = True # pylint:disable=protected-access config._get_config_file_path(utils.uuid4(), utils.uuid4()) self.assertGreater(isfile.call_count, 0)
def test_failures(self): """Assert the method raises an exception when no config is found.""" with mock.patch.object(xdg.BaseDirectory, 'load_config_paths') as lcp: lcp.return_value = ('an_iterable', 'of_xdg', 'config_paths') with mock.patch.object(os.path, 'isfile') as isfile: isfile.return_value = False with self.assertRaises(exceptions.ConfigFileNotFoundError): # pylint:disable=protected-access config._get_config_file_path(utils.uuid4(), utils.uuid4()) self.assertGreater(isfile.call_count, 0)