Beispiel #1
0
 def test_add_to_multiple(self):
     file_obj = self._to_memcache(fixture_path('git_config_multiple'))
     with GitConfigParser(file_obj, read_only=False) as cw:
         cw.add_value('section1', 'option1', 'value1c')
         cw.write()
         file_obj.seek(0)
         cr = GitConfigParser(file_obj, read_only=True)
         self.assertEqual(cr.get_value('section1', 'option1'), 'value1c')
         self.assertEqual(cr.get_values('section1', 'option1'),
                          ['value1a', 'value1b', 'value1c'])
         self.assertEqual(cr.items('section1'),
                          [('option1', 'value1c'),
                           ('other_option1', 'other_value1')])
         self.assertEqual(cr.items_all('section1'),
                          [('option1', ['value1a', 'value1b', 'value1c']),
                           ('other_option1', ['other_value1'])])