Skip to content

proxy

Proxy(ta_name, ta_proxy_url, ta_conf='', ucc_smartx_selenium_helper=None, ucc_smartx_rest_helper=None)

Bases: Entity

Parameters:

Name Type Description Default
ta_name

Name of TA

required
ta_conf

Name of conf file

''
ucc_smartx_selenium_helper

Fixture with selenium driver, urls(web, mgmt) and session key

None
ucc_smartx_rest_helper

Fixture with selenium driver, urls(mgmt)

None
Source code in pytest_splunk_addon_ui_smartx/pages/proxy.py
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
def __init__(
    self,
    ta_name,
    ta_proxy_url,
    ta_conf="",
    ucc_smartx_selenium_helper=None,
    ucc_smartx_rest_helper=None,
):
    """
    :param ta_name: Name of TA
    :param ta_conf: Name of conf file
    :param ucc_smartx_selenium_helper: Fixture with selenium driver, urls(web, mgmt) and session key
    :param ucc_smartx_rest_helper: Fixture with selenium driver, urls(mgmt)
    """
    self.ta_name = ta_name
    self.ta_proxy_url = ta_proxy_url
    self.ta_conf = ta_conf
    if self.ta_conf == "":
        self.ta_conf = "{}_settings".format(self.ta_name.lower())
    entity_container = Selector(select='div[id="proxyTab"]')
    if ucc_smartx_selenium_helper:
        super().__init__(ucc_smartx_selenium_helper.browser, entity_container)
        self.splunk_web_url = ucc_smartx_selenium_helper.splunk_web_url
        self.host = TextBox(
            ucc_smartx_selenium_helper.browser,
            Selector(select='[data-test="control-group"][data-name="proxy_url"]'),
        )
        self.port = TextBox(
            ucc_smartx_selenium_helper.browser,
            Selector(select='[data-test="control-group"][data-name="proxy_port"]'),
        )
        self.username = TextBox(
            ucc_smartx_selenium_helper.browser,
            Selector(
                select='[data-test="control-group"][data-name="proxy_username"]'
            ),
        )
        self.password = TextBox(
            ucc_smartx_selenium_helper.browser,
            Selector(
                select='[data-test="control-group"][data-name="proxy_password"]'
            ),
            encrypted=True,
        )
        self.proxy_enable = Checkbox(
            ucc_smartx_selenium_helper.browser,
            Selector(
                select='[data-test="control-group"][data-name="proxy_enabled"]'
            ),
        )
        self.dns_enable = Checkbox(
            ucc_smartx_selenium_helper.browser,
            Selector(select='[data-test="control-group"][data-name="proxy_rdns"]'),
        )
        self.type = SingleSelect(
            ucc_smartx_selenium_helper.browser,
            Selector(select='[data-test="control-group"][data-name="proxy_type"]'),
        )
        self.open()
    if ucc_smartx_rest_helper:
        self.splunk_mgmt_url = ucc_smartx_rest_helper.splunk_mgmt_url
        self.backend_conf_post = SingleBackendConf(
            self._get_proxy_configs_endpoint(),
            ucc_smartx_rest_helper.username,
            ucc_smartx_rest_helper.password,
        )
        self.backend_conf_get = SingleBackendConf(
            self._get_proxy_endpoint(),
            ucc_smartx_rest_helper.username,
            ucc_smartx_rest_helper.password,
        )

open()

Open the required page. Page(super) class opens the page by default.

Source code in pytest_splunk_addon_ui_smartx/pages/proxy.py
102
103
104
105
106
107
108
109
110
def open(self):
    """
    Open the required page. Page(super) class opens the page by default.
    """
    self.browser.get(
        "{}/en-US/app/{}/configuration".format(self.splunk_web_url, self.ta_name)
    )
    tab = Tab(self.browser)
    tab.open_tab("proxy")