Beispiel #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')
Beispiel #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()
Beispiel #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
Beispiel #4
0
    def test_version(self):
        sh = shell.Shell(['version'])
        sh.execute()

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

        self.client_inst.synchronize_all.assert_called_once_with()
Beispiel #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!')
Beispiel #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()
Beispiel #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')
Beispiel #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()
Beispiel #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()
Beispiel #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')
Beispiel #12
0
 def test_shell(self):
     sh = shell.Shell(['list'])
     assert sh.args == ['list']
     self.client_mock.assert_called_once_with()
Beispiel #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()