def test_with_args(self, parserclass): """Expect arguments pass to the parser after user config file.""" mock_conf = parserclass.return_value result = config.load('spam', 'ham', 'eggs') self.assertIs(result, mock_conf) mock_conf.read.assert_called_once_with((config.user_path(), 'spam', 'ham', 'eggs'))
def test_path(self): """Expect filepath joinning '.yanico.conf' under $HOME.""" if os.sep == '\\': expect = 'spam\\.yanico.conf' elif os.sep == '/': expect = 'spam/.yanico.conf' result = config.user_path() self.assertEqual(result, expect)
def test_without_args(self, parserclass): """Expect config object that tried to parse user config file.""" mock_conf = parserclass.return_value result = config.load() self.assertIs(result, mock_conf) mock_conf.read.assert_called_once_with((config.user_path(),))
def test_dependence_constants(self): """Expect to depend filename by 'CONFIG_FILENAME' constants.""" result = config.user_path() self.assertEqual(os.path.basename(result), 'ham.egg')