Exemple #1
0
    def testInstanceAugmentationProxiedMaster(self):
        import ploy.tests.dummy_proxy_plugin
        import ploy.plain

        self.configfile.fill(
            [
                "[plain-instance:foo]",
                "somevalue = ham",
                "[dummy-master:master]",
                "instance = foo",
                "[dummy-instance:bar]",
                "dummy_value = egg",
            ]
        )
        ctrl = Controller(configpath=self.directory)
        ctrl.configfile = self.configfile.path
        ctrl.plugins = {"dummy": ploy.tests.dummy_proxy_plugin.plugin, "plain": ploy.plain.plugin}
        # trigger augmentation of all instances
        instances = dict(ctrl.instances)
        # check the proxied value, which is only accessible through the instance config
        assert "somevalue" in instances["master"].config
        assert instances["master"].config["somevalue"] == "ham"
        # we check that the main config is updated for the remaining values,
        # not only the individual instance configs
        assert "dummy_value" in ctrl.config["dummy-instance"]["bar"]
        assert ctrl.config["dummy-instance"]["bar"]["dummy_value"] == "egg massaged"
        assert "dummy_augmented" in ctrl.config["dummy-instance"]["bar"]
        assert ctrl.config["dummy-instance"]["bar"]["dummy_augmented"] == "augmented massaged"
Exemple #2
0
 def testInstanceAugmentationProxiedMaster(self):
     import ploy.tests.dummy_proxy_plugin
     import ploy.plain
     self.configfile.fill([
         '[plain-instance:foo]',
         'somevalue = ham',
         '[dummy-master:master]',
         'instance = foo',
         '[dummy-instance:bar]',
         'dummy_value = egg'])
     ctrl = Controller(configpath=self.directory)
     ctrl.configfile = self.configfile.path
     ctrl.plugins = {
         'dummy': ploy.tests.dummy_proxy_plugin.plugin,
         'plain': ploy.plain.plugin}
     # trigger augmentation of all instances
     instances = dict(ctrl.instances)
     # check the proxied value, which is only accessible through the instance config
     assert 'somevalue' in instances['master'].config
     assert instances['master'].config['somevalue'] == 'ham'
     # we check that the main config is updated for the remaining values,
     # not only the individual instance configs
     assert 'dummy_value' in ctrl.config['dummy-instance']['bar']
     assert ctrl.config['dummy-instance']['bar']['dummy_value'] == 'egg massaged'
     assert 'dummy_augmented' in ctrl.config['dummy-instance']['bar']
     assert ctrl.config['dummy-instance']['bar']['dummy_augmented'] == 'augmented massaged'
def ctrl(ployconf):
    from ploy import Controller
    import ploy_virtualbox
    ployconf.fill(['[vb-instance:foo]'])
    ctrl = Controller(configpath=ployconf.directory)
    ctrl.plugins = {'virtualbox': ploy_virtualbox.plugin}
    yield ctrl
Exemple #4
0
def ctrl(ployconf, tempdir):
    from ploy import Controller
    import ploy.tests.dummy_plugin
    ctrl = Controller(tempdir.directory)
    ctrl.plugins = {'dummy': ploy.tests.dummy_plugin.plugin}
    ctrl.configfile = ployconf.path
    return ctrl
Exemple #5
0
def ctrl(ployconf, tempdir, sshconfig):
    import ploy.plain
    ctrl = Controller(tempdir.directory)
    ctrl.plugins = {
        'plain': ploy.plain.plugin}
    ctrl.configfile = ployconf.path
    return ctrl
Exemple #6
0
 def testMissingConfig(self):
     os.remove(self.configfile.path)
     ctrl = Controller(configpath=self.directory)
     ctrl.configfile = self.configfile.path
     with patch('ploy.log') as LogMock:
         with pytest.raises(SystemExit):
             ctrl.config
         LogMock.error.assert_called_with("Config '%s' doesn't exist." % ctrl.configfile)
def ctrl(ployconf):
    from ploy import Controller
    import ploy_virtualbox
    ployconf.fill([
        '[vb-instance:foo]'])
    ctrl = Controller(configpath=ployconf.directory)
    ctrl.plugins = {'virtualbox': ploy_virtualbox.plugin}
    yield ctrl
Exemple #8
0
 def testMissingConfig(self):
     os.remove(self.configfile.path)
     ctrl = Controller(configpath=self.directory)
     ctrl.configfile = self.configfile.path
     with patch("ploy.log") as LogMock:
         with pytest.raises(SystemExit):
             ctrl.config
         LogMock.error.assert_called_with("Config '%s' doesn't exist." % ctrl.configfile)
Exemple #9
0
def ctrl(ployconf, tempdir):
    from ploy import Controller
    import ploy.tests.dummy_plugin
    ctrl = Controller(tempdir.directory)
    ctrl.plugins = {
        'dummy': ploy.tests.dummy_plugin.plugin}
    ctrl.configfile = ployconf.path
    return ctrl
Exemple #10
0
    def testInstanceAugmentation(self):
        import ploy.tests.dummy_plugin

        self.configfile.fill(["[dummy-instance:foo]"])
        ctrl = Controller(configpath=self.directory)
        ctrl.configfile = self.configfile.path
        ctrl.plugins = {"dummy": ploy.tests.dummy_plugin.plugin}
        assert "dummy_augmented" in ctrl.instances["foo"].config
        assert ctrl.instances["foo"].config["dummy_augmented"] == "augmented massaged"
Exemple #11
0
def ctrl(ployconf):
    import ploy_fabric
    import ploy.tests.dummy_plugin
    ctrl = Controller(ployconf.directory)
    ctrl.plugins = {
        'dummy': ploy.tests.dummy_plugin.plugin,
        'fabric': ploy_fabric.plugin}
    ctrl.configfile = ployconf.path
    return ctrl
Exemple #12
0
 def testConflictingPluginCommandName(self):
     ctrl = Controller(configpath=self.directory)
     ctrl.configfile = self.configfile.path
     ctrl.plugins = dict(dummy=dict(
         get_commands=lambda x: [
             ('ssh', None)]))
     with patch('ploy.log') as LogMock:
         with pytest.raises(SystemExit):
             ctrl([])
     LogMock.error.assert_called_with("Command name '%s' of '%s' conflicts with existing command name.", 'ssh', 'dummy')
Exemple #13
0
def ctrl(ployconf, iocage_tag):
    from ploy import Controller
    import ploy_iocage
    lines = ['[ioc-master:warden]', '[ioc-instance:foo]', 'ip = 10.0.0.1']
    if iocage_tag is not 'foo':
        lines.append('iocage-tag = %s' % iocage_tag)
    ployconf.fill(lines)
    ctrl = Controller(configpath=ployconf.directory)
    ctrl.plugins = {'iocage': ploy_iocage.plugin}
    return ctrl
Exemple #14
0
 def testConflictingPluginCommandName(self):
     ctrl = Controller(configpath=self.directory)
     ctrl.configfile = self.configfile.path
     ctrl.plugins = dict(dummy=dict(get_commands=lambda x: [("ssh", None)]))
     with patch("ploy.log") as LogMock:
         with pytest.raises(SystemExit):
             ctrl([])
     LogMock.error.assert_called_with(
         "Command name '%s' of '%s' conflicts with existing command name.", "ssh", "dummy"
     )
Exemple #15
0
 def testInstanceAugmentation(self):
     import ploy.tests.dummy_plugin
     self.configfile.fill([
         '[dummy-instance:foo]'])
     ctrl = Controller(configpath=self.directory)
     ctrl.configfile = self.configfile.path
     ctrl.plugins = {
         'dummy': ploy.tests.dummy_plugin.plugin}
     assert 'dummy_augmented' in ctrl.instances['foo'].config
     assert ctrl.instances['foo'].config['dummy_augmented'] == 'augmented massaged'
Exemple #16
0
def ctrl(ployconf):
    from ploy import Controller
    import ploy_ezjail
    ployconf.fill([
        '[ez-master:warden]',
        '[ez-instance:foo]',
        'ip = 10.0.0.1'])
    ctrl = Controller(configpath=ployconf.directory)
    ctrl.plugins = {'ezjail': ploy_ezjail.plugin}
    yield ctrl
Exemple #17
0
def ctrl(ployconf):
    from ploy import Controller
    import ploy_ansible
    import ploy.tests.dummy_plugin
    ployconf.fill([
        '[dummy-instance:foo]'])
    ctrl = Controller(configpath=ployconf.directory)
    ctrl.plugins = {
        'dummy': ploy.tests.dummy_plugin.plugin,
        'ansible': ploy_ansible.plugin}
    return ctrl
Exemple #18
0
 def testInvalidInstanceName(self):
     import ploy.tests.dummy_plugin
     self.configfile.fill([
         '[dummy-instance:fo o]'])
     ctrl = Controller(configpath=self.directory)
     ctrl.configfile = self.configfile.path
     ctrl.plugins = {'dummy': ploy.tests.dummy_plugin.plugin}
     with patch('ploy.common.log') as LogMock:
         with pytest.raises(SystemExit):
             ctrl(['./bin/ploy', 'ssh', 'bar'])
     LogMock.error.assert_called_with("Invalid instance name 'fo o'. An instance name may only contain letters, numbers, dashes and underscores.")
Exemple #19
0
def ctrl(ployconf):
    from ploy import Controller
    import ploy.plain
    import ploy.tests.dummy_proxy_plugin
    ployconf.fill([''])
    ctrl = Controller(configpath=ployconf.directory)
    ctrl.plugins = {
        'dummy': ploy.tests.dummy_proxy_plugin.plugin,
        'plain': ploy.plain.plugin}
    ctrl.configfile = ployconf.path
    return ctrl
Exemple #20
0
def ctrl(ployconf):
    from ploy import Controller
    import ploy.plain
    import ploy.tests.dummy_proxy_plugin
    ployconf.fill([''])
    ctrl = Controller(configpath=ployconf.directory)
    ctrl.plugins = {
        'dummy': ploy.tests.dummy_proxy_plugin.plugin,
        'plain': ploy.plain.plugin
    }
    ctrl.configfile = ployconf.path
    return ctrl
Exemple #21
0
def ctrl(ployconf, ezjail_name):
    from ploy import Controller
    import ploy_ezjail
    lines = [
        '[ez-master:warden]',
        '[ez-instance:foo]',
        'ip = 10.0.0.1']
    if ezjail_name is not 'foo':
        lines.append('ezjail-name = %s' % ezjail_name)
    ployconf.fill(lines)
    ctrl = Controller(configpath=ployconf.directory)
    ctrl.plugins = {'ezjail': ploy_ezjail.plugin}
    return ctrl
def ctrl(ployconf, iocage_tag):
    from ploy import Controller
    import ploy_iocage
    lines = [
        '[ioc-master:warden]',
        '[ioc-instance:foo]',
        'ip = 10.0.0.1']
    if iocage_tag is not 'foo':
        lines.append('iocage-tag = %s' % iocage_tag)
    ployconf.fill(lines)
    ctrl = Controller(configpath=ployconf.directory)
    ctrl.plugins = {'iocage': ploy_iocage.plugin}
    return ctrl
Exemple #23
0
    def testConflictingInstanceShortName(self):
        import ploy.tests.dummy_plugin
        import ploy.plain

        self.configfile.fill(["[dummy-instance:foo]", "[plain-instance:foo]"])
        ctrl = Controller(configpath=self.directory)
        ctrl.configfile = self.configfile.path
        ctrl.plugins = {"dummy": ploy.tests.dummy_plugin.plugin, "plain": ploy.plain.plugin}
        with patch("sys.stderr") as StdErrMock:
            with pytest.raises(SystemExit):
                ctrl(["./bin/ploy", "ssh", "bar"])
        output = "".join(x[0][0] for x in StdErrMock.write.call_args_list)
        assert "(choose from 'default-foo', 'plain-foo')" in output
Exemple #24
0
    def testInvalidInstanceName(self):
        import ploy.tests.dummy_plugin

        self.configfile.fill(["[dummy-instance:fo o]"])
        ctrl = Controller(configpath=self.directory)
        ctrl.configfile = self.configfile.path
        ctrl.plugins = {"dummy": ploy.tests.dummy_plugin.plugin}
        with patch("ploy.common.log") as LogMock:
            with pytest.raises(SystemExit):
                ctrl(["./bin/ploy", "ssh", "bar"])
        LogMock.error.assert_called_with(
            "Invalid instance name 'fo o'. An instance name may only contain letters, numbers, dashes and underscores."
        )
Exemple #25
0
def ctrl(ployconf, tempdir):
    from ploy import Controller
    import bsdploy
    import ploy_ezjail
    import ploy_ansible
    ployconf.fill(['[ez-master:jailhost]'])
    ctrl = Controller(configpath=ployconf.directory)
    ctrl.plugins = {
        'bsdploy': bsdploy.plugin,
        'ezjail': ploy_ezjail.plugin,
        'ansible': ploy_ansible.plugin
    }
    ctrl.configfile = ployconf.path
    return ctrl
Exemple #26
0
def test_instance_massagers():
    directory = tempfile.mkdtemp()
    ctrl = Controller(directory)
    ctrl.configfile = os.path.join(directory, 'ploy.conf')
    _write_config(directory, '\n'.join([
        '[instance:bar]',
        'master = default',
        'startup_script = startup.sh',
        '[ec2-instance:ham]']))
    massagers = ctrl.instances['bar'].config.massagers
    assert massagers != {}
    assert ctrl.instances['bar'].config == {
        'startup_script': {'path': os.path.join(directory, 'startup.sh')},
        'master': 'default'}
Exemple #27
0
def ctrl(ployconf, tempdir):
    from ploy import Controller
    import bsdploy
    import ploy_ezjail
    import ploy_ansible
    ployconf.fill([
        '[ez-master:jailhost]'])
    ctrl = Controller(configpath=ployconf.directory)
    ctrl.plugins = {
        'bsdploy': bsdploy.plugin,
        'ezjail': ploy_ezjail.plugin,
        'ansible': ploy_ansible.plugin}
    ctrl.configfile = ployconf.path
    return ctrl
Exemple #28
0
 def testConflictingInstanceShortName(self):
     import ploy.tests.dummy_plugin
     import ploy.plain
     self.configfile.fill([
         '[dummy-instance:foo]',
         '[plain-instance:foo]'])
     ctrl = Controller(configpath=self.directory)
     ctrl.configfile = self.configfile.path
     ctrl.plugins = {
         'dummy': ploy.tests.dummy_plugin.plugin,
         'plain': ploy.plain.plugin}
     with patch('sys.stderr') as StdErrMock:
         with pytest.raises(SystemExit):
             ctrl(['./bin/ploy', 'ssh', 'bar'])
     output = "".join(x[0][0] for x in StdErrMock.write.call_args_list)
     assert "(choose from 'default-foo', 'plain-foo')" in output
Exemple #29
0
    def setUp(self):
        import ploy_openvz
        paramiko = import_paramiko()
        self.directory = tempfile.mkdtemp()
        self.ctrl = Controller(self.directory)
        self.ctrl.__dict__['plugins'] = {'vz': ploy_openvz.plugin}
        self._ssh_client_mock = patch("%s.SSHClient" % paramiko.__name__)
        self.ssh_client_mock = self._ssh_client_mock.start()
        self.ssh_client_exec_results = []

        def exec_command(cmd):
            if len(self.ssh_client_exec_results) == 0:  # pragma: no cover - only if test is wrong
                self.fail("No results for exec_command, expected on for '%s'" % cmd)
            result = self.ssh_client_exec_results.pop(0)
            if len(result) != 2 or len(result[1]) != 2:  # pragma: no cover - only if test is wrong
                self.fail("ssh_client_exec_results needs to contain tuples in the form of (expected_cmd, (stdout, stderr)).")
            self.assertEquals(cmd, result[0], 'expected command mismatch')
            return None, StringIO(result[1][0]), StringIO(result[1][1])

        self.ssh_client_mock().exec_command.side_effect = exec_command
        self._ssh_config_mock = patch("%s.SSHConfig" % paramiko.__name__)
        self.ssh_config_mock = self._ssh_config_mock.start()
        self.ssh_config_mock().lookup.return_value = {}
        self._os_execvp_mock = patch("subprocess.call")
        self.os_execvp_mock = self._os_execvp_mock.start()
Exemple #30
0
 def testCallWithNoArguments(self):
     ctrl = Controller(configpath=self.directory)
     with patch('sys.stderr') as StdErrMock:
         with pytest.raises(SystemExit):
             ctrl(['./bin/ploy'])
     output = "".join(x[0][0] for x in StdErrMock.write.call_args_list)
     assert 'usage:' in output
     assert too_view_arguments in output
Exemple #31
0
 def testOverwriteConfigPath(self):
     open(os.path.join(self.directory, 'foo.conf'), 'w').write('\n'.join([
         '[global]',
         'foo = bar']))
     ctrl = Controller(configpath=self.directory)
     ctrl(['./bin/ploy', '-c', os.path.join(self.directory, 'foo.conf'), 'help'])
     assert ctrl.configfile == os.path.join(self.directory, 'foo.conf')
     assert ctrl.config == {'global': {'global': {'foo': 'bar'}}}
Exemple #32
0
def ctrl(ployconf, tempdir):
    from ploy import Controller
    import bsdploy
    import ploy.plain
    import ploy_ezjail
    import ploy_fabric
    ployconf.fill(
        ['[ez-master:jailhost]', '[instance:foo]', 'master = jailhost'])
    ctrl = Controller(configpath=ployconf.directory)
    ctrl.plugins = {
        'bsdploy': bsdploy.plugin,
        'ezjail': ploy_ezjail.plugin,
        'fabric': ploy_fabric.plugin,
        'plain': ploy.plain.plugin
    }
    ctrl.configfile = ployconf.path
    return ctrl
Exemple #33
0
def test_instance_massagers():
    directory = tempfile.mkdtemp()
    ctrl = Controller(directory)
    ctrl.configfile = os.path.join(directory, 'ploy.conf')
    _write_config(
        directory, '\n'.join([
            '[instance:bar]', 'master = default',
            'startup_script = startup.sh', '[ec2-instance:ham]'
        ]))
    massagers = ctrl.instances['bar'].config.massagers
    assert massagers != {}
    assert ctrl.instances['bar'].config == {
        'startup_script': {
            'path': os.path.join(directory, 'startup.sh')
        },
        'master': 'default'
    }
Exemple #34
0
def ctrl(ployconf):
    from ploy import Controller
    import ploy_ansible
    import ploy.tests.dummy_plugin
    ployconf.fill([
        '[dummy-instance:foo]',
        'host = foo'])
    ctrl = Controller(ployconf.directory)
    ctrl.configfile = ployconf.path
    ctrl.plugins = {
        'dummy': ploy.tests.dummy_plugin.plugin,
        'ansible': ploy_ansible.plugin}
    if hasattr(ploy_ansible, 'display'):
        ploy_ansible.display._deprecations.clear()
        ploy_ansible.display._warns.clear()
        ploy_ansible.display._errors.clear()
    return ctrl
Exemple #35
0
def ctrl(ployconf, tempdir):
    from ploy import Controller
    import bsdploy
    import ploy.plain
    import ploy_ezjail
    import ploy_fabric
    ployconf.fill([
        '[ez-master:jailhost]',
        '[instance:foo]',
        'master = jailhost'])
    ctrl = Controller(configpath=ployconf.directory)
    ctrl.plugins = {
        'bsdploy': bsdploy.plugin,
        'ezjail': ploy_ezjail.plugin,
        'fabric': ploy_fabric.plugin,
        'plain': ploy.plain.plugin}
    ctrl.configfile = ployconf.path
    return ctrl
Exemple #36
0
 def setup_ctrl(self, os_execvp_mock, paramiko, sshclient, sshconfig, tempdir):
     import ploy.plain
     self.directory = tempdir.directory
     self.ctrl = Controller(self.directory)
     self.ctrl.plugins = {
         'plain': ploy.plain.plugin}
     self.paramiko = paramiko
     self.ssh_client_mock = sshclient
     self.os_execvp_mock = os_execvp_mock
Exemple #37
0
 def ctrl(self, ployconf):
     from ploy import Controller
     import ploy.tests.dummy_plugin
     ployconf.fill([
         '[dummy-master:warden]',
         '[dummy-master:master]',
         '[dummy-master:another]',
         '[dummy-instance:foo]',
         'master = warden',
         '[dummy-instance:bar]',
         'master = master',
         '[dummy-instance:ham]',
         'master = warden master',
         '[dummy-instance:egg]'])
     ctrl = Controller(configpath=ployconf.directory)
     ctrl.plugins = {
         'dummy': ploy.tests.dummy_plugin.plugin}
     ctrl.configfile = ployconf.path
     yield ctrl
Exemple #38
0
 def ctrl(self, ployconf):
     from ploy import Controller
     import ploy.tests.dummy_plugin
     ployconf.fill([
         '[dummy-master:warden]',
         '[dummy-master:master]',
         '[dummy-master:another]',
         '[dummy-instance:foo]',
         'master = warden',
         '[dummy-instance:bar]',
         'master = master',
         '[dummy-instance:ham]',
         'master = warden master',
         '[dummy-instance:egg]'])
     ctrl = Controller(configpath=ployconf.directory)
     ctrl.plugins = {
         'dummy': ploy.tests.dummy_plugin.plugin}
     ctrl.configfile = ployconf.path
     yield ctrl
Exemple #39
0
 def setup_ctrl(self, ployconf, tempdir):
     import ploy.tests.dummy_plugin
     ployconf.fill([
         '[dummy-master:master]',
         '[instance:foo]',
         'master = master',
         'startup_script = ../startup'])
     tempdir['startup'].fill('startup')
     self.ctrl = Controller(ployconf.directory)
     self.ctrl.configfile = ployconf.path
     self.ctrl.plugins = {'dummy': ploy.tests.dummy_plugin.plugin}
Exemple #40
0
 def setUp(self):
     import ploy_openvz
     paramiko = import_paramiko()
     self.directory = tempfile.mkdtemp()
     self.ctrl = Controller(self.directory)
     self.ctrl.__dict__['plugins'] = {'vz': ploy_openvz.plugin}
     self._ssh_client_mock = patch("%s.SSHClient" % paramiko.__name__)
     self.ssh_client_mock = self._ssh_client_mock.start()
     self._ssh_config_mock = patch("%s.SSHConfig" % paramiko.__name__)
     self.ssh_config_mock = self._ssh_config_mock.start()
     self.ssh_config_mock().lookup.return_value = {}
     self._os_execvp_mock = patch("os.execvp")
     self.os_execvp_mock = self._os_execvp_mock.start()
Exemple #41
0
 def setUp(self):
     self.directory = tempfile.mkdtemp()
     self.ctrl = Controller(self.directory)
     self._boto_ec2_regions_mock = patch("boto.ec2.regions")
     self.boto_ec2_regions_mock = self._boto_ec2_regions_mock.start()
     try:  # pragma: no cover - we support both
         self._ssh_client_mock = patch("paramiko.SSHClient")
     except ImportError:  # pragma: no cover - we support both
         self._ssh_client_mock = patch("ssh.SSHClient")
     self.ssh_client_mock = self._ssh_client_mock.start()
     try:  # pragma: no cover - we support both
         self._ssh_config_mock = patch("paramiko.SSHConfig")
     except ImportError:  # pragma: no cover - we support both
         self._ssh_config_mock = patch("ssh.SSHConfig")
     self.ssh_config_mock = self._ssh_config_mock.start()
     self.ssh_config_mock().lookup.return_value = {}
     self._os_execvp_mock = patch("os.execvp")
     self.os_execvp_mock = self._os_execvp_mock.start()
     self.key = os.path.join(self.directory, 'key')
     with open(self.key, 'w') as f:
         f.write('ham')
     self.secret = os.path.join(self.directory, 'secret')
     with open(self.secret, 'w') as f:
         f.write('egg')
Exemple #42
0
 def testKnownHosts(self):
     ctrl = Controller(configpath=self.directory)
     ctrl.configfile = self.configfile.path
     assert ctrl.known_hosts == os.path.join(self.directory, 'known_hosts')
Exemple #43
0
 def testKnownHosts(self):
     ctrl = Controller(configpath=self.directory)
     ctrl.configfile = self.configfile.path
     assert ctrl.known_hosts == os.path.join(self.directory, "known_hosts")
Exemple #44
0
 def testKnownHostsWithNoConfigErrors(self):
     os.remove(self.configfile.path)
     ctrl = Controller(configpath=self.directory)
     ctrl.configfile = self.configfile.path
     with pytest.raises(SystemExit):
         ctrl.known_hosts
Exemple #45
0
 def testDefaultConfigPath(self):
     ctrl = Controller()
     ctrl(['./bin/ploy', 'help'])
     assert ctrl.configfile == 'etc/ploy.conf'
Exemple #46
0
 def setup_ctrl(self, ployconf):
     self.ctrl = Controller(ployconf.directory)
     self.ctrl.configfile = ployconf.path
     self._write_config = ployconf.fill
     self._write_config('')
Exemple #47
0
 def testKnownHostsWithNoConfigErrors(self):
     os.remove(self.configfile.path)
     ctrl = Controller(configpath=self.directory)
     ctrl.configfile = self.configfile.path
     with pytest.raises(SystemExit):
         ctrl.known_hosts
Exemple #48
0
 def testDirectoryAsConfig(self):
     ctrl = Controller(configpath=self.directory)
     ctrl(['./bin/ploy', 'help'])
     assert ctrl.configfile == self.configfile.path
Exemple #49
0
 def testFileConfigName(self):
     ctrl = Controller(configpath=self.directory, configname='foo.conf')
     ctrl(['./bin/ploy', 'help'])
     assert ctrl.configfile == os.path.join(self.directory, 'foo.conf')
Exemple #50
0
 def setup_ctrl(self, ployconf, os_execvp_mock):
     self.directory = ployconf.directory
     self.ctrl = Controller(ployconf.directory)
     self.ctrl.configfile = ployconf.path
     self._write_config = ployconf.fill
     self.os_execvp_mock = os_execvp_mock