def test_system_info_with_motd(self): mock_ssh = mock.MagicMock() mock_ssh.execute.return_value = { 'exit_code': 0, 'stdout': "Hello world\n {}", 'stderr': "" } ohai_solo.system_info(mock_ssh) mock_ssh.execute.assert_called_with("sudo -i ohai-solo")
def test_system_info_with_motd(self): self.mock_remotesshclient.execute.return_value = { 'exit_code': 0, 'stdout': "Hello world\n {}", 'stderr': "" } ohai_solo.system_info(self.mock_remotesshclient) self.mock_remotesshclient.execute.assert_called_with( "unset GEM_CACHE GEM_HOME GEM_PATH && sudo ohai-solo", escalate=True, allow_many=False)
def test_system_info_with_install_dir_with_spaces(self): self.mock_remotesshclient.execute.return_value = { 'exit_code': 0, 'stdout': "{}", 'stderr': "" } ohai_solo.system_info(self.mock_remotesshclient, install_dir='/sys/omg * " lol/') self.mock_remotesshclient.execute.assert_called_with( "unset GEM_CACHE GEM_HOME GEM_PATH && " 'sudo \'/sys/omg * " lol/\'/ohai-solo/bin/ohai-solo', escalate=True, allow_many=False)
def test_system_info_with_install_dir(self): self.mock_remotesshclient.execute.return_value = { 'exit_code': 0, 'stdout': "{}", 'stderr': "" } ohai_solo.system_info(self.mock_remotesshclient, install_dir='/home/user') self.mock_remotesshclient.execute.assert_called_with( "unset GEM_CACHE GEM_HOME GEM_PATH && " "sudo /home/user/ohai-solo/bin/ohai-solo", escalate=True, allow_many=False)
def test_system_info_with_install_dir_with_spaces(self): self.mock_remotesshclient.execute.return_value = { 'exit_code': 0, 'stdout': "{}", 'stderr': "" } ohai_solo.system_info(self.mock_remotesshclient, install_dir='/sys/omg * " lol/') self.mock_remotesshclient.execute.assert_called_with( "unset GEM_CACHE GEM_HOME GEM_PATH && " 'sudo \'/sys/omg * " lol//ohai-solo/bin/ohai-solo\'', escalate=True, allow_many=False)