def _login(self, browser, user, password):
        """Log the user in an existing browser using his password"""

        browser.open(make_surl('/youraccount/login'))
        browser.select_form(nr=0)
        browser['p_un'] = user
        browser['p_pw'] = password
        browser.submit()
Exemplo n.º 2
0
    def _login(self, browser, user, password):
        """Log the user in an existing browser using his password"""

        browser.open(make_surl('/youraccount/login'))
        browser.select_form(nr=0)
        browser['p_un'] = user
        browser['p_pw'] = password
        browser.submit()
    def _check_basket_content(self, browser, expected_texts):
        """goes to the baskets page and checks the content for a specified text.

        expected_texts is a list of strings containing text that is we expect
        to be shown on the page."""

        browser.open(make_surl('/yourbaskets/display?ln=en'))
        url_body = browser.response().read()

        for current_expected_text in expected_texts:
            if current_expected_text not in url_body:
                self.fail('Expects to find ' + current_expected_text + ' in the basket')
Exemplo n.º 4
0
    def _check_basket_content(self, browser, expected_texts):
        """goes to the baskets page and checks the content for a specified text.

        expected_texts is a list of strings containing text that is we expect
        to be shown on the page."""

        browser.open(make_surl('/yourbaskets/display?ln=en'))
        url_body = browser.response().read()

        for current_expected_text in expected_texts:
            if current_expected_text not in url_body:
                self.fail('Expects to find ' + current_expected_text + ' in the basket')
    def _delete_basket(self, browser):
        """deletes the first basket in the list of baskets on Display baskets page"""

        # go to Display baskets page
        browser.open(make_surl('/yourbaskets/display?ln=en'))

        # click Edit basket link
        browser.follow_link(text_regex=re.compile('.*Edit basket', re.I))

        # click Delete basket button on the page
        browser.select_form(name = 'edit')
        browser.submit(name = 'delete')

        # answer yes to the question "Are you sure..."
        browser.select_form(name = 'validate')
        browser.submit()
Exemplo n.º 6
0
    def _delete_basket(self, browser):
        """deletes the first basket in the list of baskets on Display baskets page"""

        # go to Display baskets page
        browser.open(make_surl('/yourbaskets/display?ln=en'))

        # click Edit basket link
        browser.follow_link(text_regex=re.compile('.*Edit basket', re.I))

        # click Delete basket button on the page
        browser.select_form(name = 'edit')
        browser.submit(name = 'delete')

        # answer yes to the question "Are you sure..."
        browser.select_form(name = 'validate')
        browser.submit()