From b14a98d0128409a3ffa1b3b79324b2021591f225 Mon Sep 17 00:00:00 2001 From: Gaurav Talreja Date: Fri, 31 May 2024 01:04:04 +0530 Subject: [PATCH] Remove nailgun entity_mixin import from discovery tests (#15164) Remove nailgun entity_mixin import from discovery test Signed-off-by: Gaurav Talreja --- robottelo/config/__init__.py | 9 +++++++++ tests/foreman/destructive/test_discoveredhost.py | 4 ++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/robottelo/config/__init__.py b/robottelo/config/__init__.py index cca2258c7e6..d761dd06e91 100644 --- a/robottelo/config/__init__.py +++ b/robottelo/config/__init__.py @@ -90,6 +90,15 @@ def get_url(): return urlunsplit((scheme, hostname, '', '', '')) +def admin_nailgun_config(): + """Return a NailGun configuration file constructed from default admin user credentials. + + :return: ``nailgun.config.ServerConfig`` object, populated from admin user credentials. + + """ + return ServerConfig(get_url(), get_credentials(), verify=settings.server.verify_ca) + + def user_nailgun_config(username=None, password=None): """Return a NailGun configuration file constructed from default values. diff --git a/tests/foreman/destructive/test_discoveredhost.py b/tests/foreman/destructive/test_discoveredhost.py index 86568230e0d..e779aab52c9 100644 --- a/tests/foreman/destructive/test_discoveredhost.py +++ b/tests/foreman/destructive/test_discoveredhost.py @@ -13,10 +13,10 @@ from copy import copy import re -from nailgun import entity_mixins import pytest from wait_for import TimedOutError, wait_for +from robottelo.config import admin_nailgun_config from robottelo.logging import logger pytestmark = pytest.mark.destructive @@ -124,7 +124,7 @@ def _assert_discovered_host(host, channel=None, user_config=None, sat=None): # raise assertion error raise AssertionError('Timed out waiting for "/facts" 201 response') from err - default_config = entity_mixins.DEFAULT_SERVER_CONFIG + default_config = admin_nailgun_config() try: wait_for(