def call_and_assert_install_with_rpm_specifier(self, mock_download_rpm, mock_check_rpm, mock_execute, location, rpm_specifier, rpm_path): if location == 'local' or location == 'download': server.install(rpm_specifier) if location == 'local': mock_download_rpm.assert_not_called() else: self.assertTrue(mock_download_rpm.called) mock_check_rpm.assert_called_with(rpm_path) mock_execute.assert_called_with(server.deploy_install_configure, rpm_path, hosts=get_host_list()) elif location == 'none': self.assertRaises(SystemExit, server.install, rpm_specifier) mock_check_rpm.assert_not_called() mock_execute.assert_not_called() else: exit('Cannot assert because of invalid location: %s' % location)
def test_install_server(self, mock_install): local_path = os.path.join("/any/path/rpm") server.install(local_path) mock_install.assert_called_with(local_path)
def test_install_server(self, mock_execute, mock_check_rpm): local_path = "/any/path/rpm" server.install(local_path) mock_check_rpm.assert_called_with(local_path) mock_execute.assert_called_with(server.deploy_install_configure, local_path, hosts=get_host_list())