Exemple #1
0
    def test_connection(self):
        """Test the connection with the corresponding button in the UI.
        Return the number of found users.
        """
        driver = self.driver
        self.driver.get(self.base_url + "/manage")
        hover(self.driver, find_by_css(self.driver, "#menu > li"))
        find_by_id(driver, "menu_edit_resolvers").click()

        resolvers = self.driver.find_elements_by_css_selector("#resolvers_list > ol > li")

        for resolver in resolvers:
            if resolver.text == self.name_for_list:
                resolver.click()

        self.driver.find_element_by_id("button_resolver_edit").click()
        find_by_id(driver, self.testbutton_id).click()

        time.sleep(2)
        alert_box = find_by_id(driver, "alert_box_text")
        alert_box_text = alert_box.text
        self.driver.find_element_by_xpath("//button[@type='button' and ancestor::div[@aria-describedby='alert_box']]").click()

        m = re.search("Number of users found: (?P<nusers>\d+)", alert_box_text)
        if m is None:
            raise Exception("text_connection for " + self.name + " failed: " + alert_box_text)
        return int(m.group('nusers'))
Exemple #2
0
    def test_connection(self):
        """Test the connection with the corresponding button in the UI.
        Return the number of found users.
        """
        driver = self.driver
        self.driver.get(self.base_url + "/manage")
        hover(self.driver, find_by_css(self.driver, "#menu > li"))
        find_by_id(driver, "menu_edit_resolvers").click()

        resolvers = self.driver.find_elements_by_css_selector(
            "#resolvers_list > ol > li")

        for resolver in resolvers:
            if resolver.text == self.name_for_list:
                resolver.click()

        self.driver.find_element_by_id("button_resolver_edit").click()
        find_by_id(driver, self.testbutton_id).click()

        time.sleep(2)
        alert_box = find_by_id(driver, "alert_box_text")
        alert_box_text = alert_box.text
        self.driver.find_element_by_xpath(
            "//button[@type='button' and ancestor::div[@aria-describedby='alert_box']]"
        ).click()

        m = re.search("Number of users found: (?P<nusers>\d+)", alert_box_text)
        if m is None:
            raise Exception("text_connection for " + self.name + " failed: " +
                            alert_box_text)
        return int(m.group('nusers'))
Exemple #3
0
    def __init__(self, name, driver, base_url):
        """Initialize values and open the menu in the UI"""
        self.name = name
        self.driver = driver
        self.base_url = base_url
        self.name_for_list = ""
        self.testbutton_id = ""

        #Open the LinOTP manage interface and the UserIdResolver menu
        driver.get(self.base_url + "/manage")
        hover(self.driver, find_by_css(driver, "#menu > li"))
        find_by_id(driver, "menu_edit_resolvers").click()
        find_by_id(driver, "button_resolver_new").click()
Exemple #4
0
    def __init__(self, name, driver, base_url):
        """Initialize values and open the menu in the UI"""
        self.name = name
        self.driver = driver
        self.base_url = base_url
        self.name_for_list = ""
        self.testbutton_id = ""

        #Open the LinOTP manage interface and the UserIdResolver menu
        driver.get(self.base_url + "/manage")
        hover(self.driver, find_by_css(driver, "#menu > li"))
        find_by_id(driver, "menu_edit_resolvers").click()
        find_by_id(driver, "button_resolver_new").click()