示例#1
0
    def test_create_env(self):
        sh = shell.Shell(['create-env', 'myenv.yaml'])
        sh.execute()

        self.client_inst.create_env_from_config.assert_called_once_with(
            'myenv.yaml')
示例#2
0
    def test_slave_remove(self):
        sh = shell.Shell(['slave-remove', 'env1', '-N', 'slave-01'])
        sh.execute()

        self.client_inst.get_env.assert_called_once_with('env1')
        self.nodes['env1']['slave-01'].remove.assert_called_once_with()
示例#3
0
    def test_net_list_none(self):
        sh = shell.Shell(['net-list', 'env2'])
        sh.execute()

        self.client_inst.get_env.assert_called_once_with('env2')
        assert self.print_mock.called is False
示例#4
0
    def test_version(self):
        sh = shell.Shell(['version'])
        sh.execute()

        assert self.print_mock.called
示例#5
0
    def test_sync(self):
        sh = shell.Shell(['sync'])
        sh.execute()

        self.client_inst.synchronize_all.assert_called_once_with()
示例#6
0
    def test_slave_ip_list_empty(self):
        sh = shell.Shell(['slave-ip-list', 'env2'])
        sh.execute()

        self.sys_mock.exit.assert_called_once_with(
            'No IPs were allocated for environment!')
示例#7
0
    def test_resume(self):
        sh = shell.Shell(['resume', 'env1'])
        sh.execute()

        self.client_inst.get_env.assert_called_once_with('env1')
        self.env_mocks['env1'].resume.assert_called_once_with()
示例#8
0
    def test_snapshot(self):
        sh = shell.Shell(['snapshot', 'env1', 'snap1'])
        sh.execute()

        self.client_inst.get_env.assert_called_once_with('env1')
        self.env_mocks['env1'].snapshot.assert_called_once_with('snap1')
示例#9
0
    def test_suspend(self):
        sh = shell.Shell(['suspend', 'env1'])
        sh.execute()

        self.client_inst.get_env.assert_called_once_with('env1')
        self.env_mocks['env1'].suspend.assert_called_once_with()
示例#10
0
    def test_destroy(self):
        sh = shell.Shell(['destroy', 'env1'])
        sh.execute()

        self.client_inst.get_env.assert_called_once_with('env1')
        self.env_mocks['env1'].destroy.assert_called_once_with()
示例#11
0
 def test_shell_command_not_create(self):
     sh = shell.Shell(['show', 'env1'])
     assert sh.args == ['show', 'env1']
     self.client_inst.get_env.assert_called_once_with('env1')
示例#12
0
 def test_shell(self):
     sh = shell.Shell(['list'])
     assert sh.args == ['list']
     self.client_mock.assert_called_once_with()
示例#13
0
    def test_node_start(self):
        sh = shell.Shell(['node-start', 'env1', '-N', 'slave-01'])
        sh.execute()

        self.client_inst.get_env.assert_called_once_with('env1')
        self.nodes['env1']['slave-01'].start.assert_called_once_with()