Пример #1
0
class TestManage(TestCase):
    """
    TestCase class that tests the manage page
    """

    @pytest.fixture(autouse=True)
    def setUp(self):
        self.manage = ManageUi(self)

    def test_manage_open(self):

        self.manage.open_manage()
        self.manage.check_url()

    def test_close_menus(self):
        """
        Verify that the manage class is able to close an open menu
        """
        self.manage.open_manage()
        menu = self.manage.find_by_css(self.manage.MENU_LINOTP_CONFIG_CSS)
        menu_item_id = "menu_edit_resolvers"

        menu.click()
        WebDriverWait(self.driver, self.ui_wait_time).until(
            EC.element_to_be_clickable((By.ID, menu_item_id))
        )
        self.manage.close_all_menus()
        WebDriverWait(self.driver, self.ui_wait_time).until_not(
            EC.element_to_be_clickable((By.ID, menu_item_id))
        )
Пример #2
0
class TestManage(TestCase):
    """
    TestCase class that tests the manage page
    """
    def setUp(self):
        TestCase.setUp(self)
        self.manage = ManageUi(self)

    def test_manage_open(self):

        self.manage.open_manage()
        self.manage.check_url()
Пример #3
0
class TestManage(TestCase):
    """
    TestCase class that tests the manage page
    """

    @pytest.fixture(autouse=True)
    def setUp(self):
        self.manage = ManageUi(self)

    def test_manage_open(self):

        self.manage.open_manage()
        self.manage.check_url()
Пример #4
0
class TestManage(TestCase):
    """
    TestCase class that tests the manage page
    """

    def setUp(self):
        TestCase.setUp(self)
        self.manage = ManageUi(self)

    def test_manage_open(self):

        self.manage.open_manage()
        self.manage.check_url()
Пример #5
0
 def setUp(self):
     TestCase.setUp(self)
     self.realm_name = "se_test_auth"
     self.reset_resolvers_and_realms(
         data.sepasswd_resolver, self.realm_name)
     self.manage = ManageUi(self)
     self.manage.token_view.delete_all_tokens()
Пример #6
0
 def setUp(self):
     self.manage = ManageUi(self)
Пример #7
0
 def test_user_filter(self):
     m = ManageUi(self)
     m.open_manage()
     user_view = UserView(m, self.realm_name)
     username = "******"
     user_view.select_user(username)
Пример #8
0
    def test_auth_index(self):
        """
        Test /auth/index form by authenticating susi with a HMAC/HOTP Token
        """
        driver = self.driver

        # Enroll HOTP token
        # Seed and OTP values: https://tools.ietf.org/html/rfc4226#appendix-D
        m = ManageUi(self)
        m.open_manage()
        user_view = UserView(driver, self.base_url, self.realm_name)
        username = "******"
        user_view.select_user(username)
        pin = "myauthpin"
        HotpToken(driver,
                  self.base_url,
                  pin=pin,
                  hmac_key="3132333435363738393031323334353637383930")
        time.sleep(1)

        otp_list = ["755224", "287082", "359152", "969429", "338314", "254676"]

        driver.get(self.base_url + "/auth/index")
        for otp in otp_list:
            driver.find_element_by_id("user").clear()
            driver.find_element_by_id("user").send_keys("susi@se_test_auth")
            driver.find_element_by_id("pass").clear()
            driver.find_element_by_id("pass").send_keys(pin + otp)
            driver.find_element_by_css_selector(
                "input[type=\"submit\"]").click()
            alert = self.driver.switch_to_alert()
            alert_text = alert.text
            alert.accept()
            self.assertEqual("User successfully authenticated!", alert_text)

        # wrong otp
        driver.find_element_by_id("user").clear()
        driver.find_element_by_id("user").send_keys("susi@se_test_auth")
        driver.find_element_by_id("pass").clear()
        driver.find_element_by_id("pass").send_keys("bla!")
        driver.find_element_by_css_selector("input[type=\"submit\"]").click()
        alert = self.driver.switch_to_alert()
        alert_text = alert.text
        alert.accept()
        self.assertEqual("User failed to authenticate!", alert_text)

        # test auth/index3
        otp_list = ["287922", "162583", "399871", "520489"]

        driver.get(self.base_url + "/auth/index3")
        for otp in otp_list:
            driver.find_element_by_id("user3").clear()
            driver.find_element_by_id("user3").send_keys("susi@se_test_auth")
            driver.find_element_by_id("pass3").clear()
            driver.find_element_by_id("pass3").send_keys(pin)
            driver.find_element_by_id("otp3").clear()
            driver.find_element_by_id("otp3").send_keys(otp)
            driver.find_element_by_css_selector(
                "input[type=\"submit\"]").click()
            alert = self.driver.switch_to_alert()
            alert_text = alert.text
            alert.accept()
            self.assertEqual("User successfully authenticated!", alert_text)

        # wrong otp
        driver.find_element_by_id("user3").clear()
        driver.find_element_by_id("user3").send_keys("susi@se_test_auth")
        driver.find_element_by_id("pass3").clear()
        driver.find_element_by_id("pass3").send_keys(pin)
        driver.find_element_by_id("otp3").clear()
        driver.find_element_by_id("otp3").send_keys("some invalid otp")
        driver.find_element_by_css_selector("input[type=\"submit\"]").click()
        alert = self.driver.switch_to_alert()
        alert_text = alert.text
        alert.accept()
        self.assertEqual("User failed to authenticate!", alert_text)
Пример #9
0
 def setUp(self):
     TestCase.setUp(self)
     self.manage = ManageUi(self)
Пример #10
0
def manage_ui(testcase) -> ManageUi:
    """Manage interface."""
    return ManageUi(testcase)
Пример #11
0
def manage_ui(testcase):
    """
    Manage interface
    """
    return ManageUi(testcase)
Пример #12
0
 def test_user_filter(self):
     m = ManageUi(self)
     m.open_manage()
     user_view = UserView(m, self.realm_name)
     username = "******"
     user_view.select_user(username)
Пример #13
0
 def setUp(self):
     TestCase.setUp(self)
     self.manage = ManageUi(self)