Esempio n. 1
0
 def _check_insights_install(self):
     connection_test_command = self.insights_command.test_connection()
     process = subprocess.Popen(connection_test_command,
                                stderr=subprocess.PIPE)
     streamdata = format_subprocess_stderr(process)
     install_check = check_insights_install(streamdata)
     if not install_check:
         print(_(messages.BAD_INSIGHTS_INSTALL %
                 (' '.join(connection_test_command))))
         sys.exit(1)
Esempio n. 2
0
 def test_check_insights_install_error_no_command(self):
     """Testing error response no command found."""
     no_command_return = 'insights-client: command not found'
     test = check_insights_install(no_command_return)
     self.assertEqual(test, False)
Esempio n. 3
0
 def test_check_insights_install_no_module(self):
     """Testing error response no modules found."""
     no_module_return = 'ModuleNotFoundError: No module named \'insights\''
     test = check_insights_install(no_module_return)
     self.assertEqual(test, False)
Esempio n. 4
0
 def test_check_insights_install(self):
     """Testing if insights is installed correctly."""
     # pylint:disable=line-too-long
     successful_install = 'Could not reach the Insights service to register.\nRunning connection test...\nConnection test config:\n=== Begin Certificate Chain Test ===\ndepth=1\nverify error:num=0\nverify return:1\ndepth=0\nverify error:num=0\nverify return:1\n=== End Certificate Chain Test: SUCCESS ===\n\n=== Begin Upload URL Connection Test ===\nHTTP Status Code: 200\nHTTP Status Text: OK\nHTTP Response Text: \nSuccessfully connected to: https://cert-api.access.redhat.com/r/insights/uploads/\n=== End Upload URL Connection Test: SUCCESS ===\n\n=== Begin API URL Connection Test ===\nHTTP Status Code: 200\nHTTP Status Text: OK\nHTTP Response Text: lub-dub\nSuccessfully connected to: https://cert-api.access.redhat.com/r/insights/\n=== End API URL Connection Test: SUCCESS ===\n\n\nConnectivity tests completed successfully\nSee /var/log/insights-client/insights-client.log for more details.\n'  # noqa: E501
     test = check_insights_install(successful_install)
     self.assertEqual(test, True)