Exemplo n.º 1
0
 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'))
Exemplo n.º 2
0
 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)
Exemplo n.º 3
0
 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(),))
Exemplo n.º 4
0
 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')