コード例 #1
0
ファイル: test_config.py プロジェクト: kernt/ploy
    def testConflictingMassagerRegistration(self):
        from ploy.config import BooleanMassager, IntegerMassager

        config = Config(StringIO('')).parse()
        config.add_massager(BooleanMassager('section', 'value'))
        with pytest.raises(ValueError) as e:
            config.add_massager(IntegerMassager('section', 'value'))
        assert unicode(e.value) == "Massager for option 'value' in section group 'section' already registered."
コード例 #2
0
ファイル: test_config.py プロジェクト: Cloudxtreme/ploy-1
    def testConflictingMassagerRegistration(self):
        from ploy.config import BooleanMassager, IntegerMassager

        config = Config(StringIO('')).parse()
        config.add_massager(BooleanMassager('section', 'value'))
        with pytest.raises(ValueError) as e:
            config.add_massager(IntegerMassager('section', 'value'))
        assert unicode(
            e.value
        ) == "Massager for option 'value' in section group 'section' already registered."
コード例 #3
0
ファイル: test_config.py プロジェクト: Cloudxtreme/ploy-1
 def testExtendFromDifferentDirectoryWithMassager(self):
     from ploy.config import PathMassager
     os.mkdir(os.path.join(self.directory, 'bar'))
     ployconf = 'ploy.conf'
     self._write_config(
         ployconf,
         '\n'.join(['[global]', 'extends = bar/foo.conf', 'ham = egg']))
     self._write_config(
         'bar/foo.conf',
         '\n'.join(['[global]', 'foo = blubber', 'ham = pork']))
     config = Config(os.path.join(self.directory, ployconf)).parse()
     config.add_massager(PathMassager('global', 'foo'))
     config.add_massager(PathMassager('global', 'ham'))
     assert config == {
         'global': {
             'global': {
                 'foo': os.path.join(self.directory, 'bar', 'blubber'),
                 'ham': os.path.join(self.directory, 'egg')
             }
         }
     }
コード例 #4
0
ファイル: test_config.py プロジェクト: kernt/ploy
 def testExtendFromDifferentDirectoryWithMassager(self):
     from ploy.config import PathMassager
     os.mkdir(os.path.join(self.directory, 'bar'))
     ployconf = 'ploy.conf'
     self._write_config(
         ployconf,
         '\n'.join([
             '[global]',
             'extends = bar/foo.conf',
             'ham = egg']))
     self._write_config(
         'bar/foo.conf',
         '\n'.join([
             '[global]',
             'foo = blubber',
             'ham = pork']))
     config = Config(os.path.join(self.directory, ployconf)).parse()
     config.add_massager(PathMassager('global', 'foo'))
     config.add_massager(PathMassager('global', 'ham'))
     assert config == {
         'global': {
             'global': {
                 'foo': os.path.join(self.directory, 'bar', 'blubber'),
                 'ham': os.path.join(self.directory, 'egg')}}}
コード例 #5
0
ファイル: test_common.py プロジェクト: kernt/ploy
 def _create_config(self, contents, path=None):
     contents = StringIO(contents)
     config = Config(contents, path=path)
     config.add_massager(
         StartupScriptMassager('instance', 'startup_script'))
     return config.parse()
コード例 #6
0
ファイル: test_common.py プロジェクト: Cloudxtreme/ploy-1
 def _create_config(self, contents, path=None):
     contents = StringIO(contents)
     config = Config(contents, path=path)
     config.add_massager(
         StartupScriptMassager('instance', 'startup_script'))
     return config.parse()