def _filter(url): m = re.search(pattern, url) if m and start<=int(m.group(group))<stop: if enc: return urlparse.unquote(url).decode('utf-8').encode(enc) else: return url return None
def _filter(url): m = re.search(pattern, url) if m and start <= int(m.group(group)) < stop: if enc: return urlparse.unquote(url).decode('utf-8').encode(enc) else: return url return None
def test_that_home_page_in_api_equals_home_page_in_details_page(self, base_url, selenium): # browser firebug_page = Details(base_url, selenium, self.firebug) browser_home_page = urlparse.unquote(firebug_page.website) # api addons_xml = AddonsAPI(base_url, self.firebug) xml_home_page = addons_xml.get_home_page() assert xml_home_page in browser_home_page
def test_that_home_page_in_api_equals_home_page_in_details_page(self, mozwebqa): # browser firebug_page = Details(mozwebqa, self.firebug) browser_home_page = urlparse.unquote(firebug_page.website) # api addons_xml = AddonsAPI(mozwebqa, self.firebug) xml_home_page = addons_xml.get_home_page() Assert.contains(xml_home_page, browser_home_page)
def test_that_home_page_in_api_equals_home_page_in_details_page(self, mozwebqa): """Test for Litmus 15336.""" #browser firebug_page = Details(mozwebqa, self.firebug) browser_home_page = urlparse.unquote(firebug_page.website) #api addons_xml = AddOnsAPI(mozwebqa) xml_home_page = addons_xml.get_home_page("firebug") Assert.contains(xml_home_page, browser_home_page)
def test_edit_view_creates_a_new_instance(self, get_model_wiki_form): object_id = "non existing item" cleaned_data = fudge.Fake('CleanedData').provides('get').returns(None) fake_form = (fudge.Fake('Form').expects('is_valid').returns(True) .expects('save') .has_attr(cleaned_data=cleaned_data)) (get_model_wiki_form.is_callable() .returns_fake().is_callable() .returns(fake_form)) resp = self.client.post('/%s' % object_id, {'action': 'edit'}) self.assertEquals(resp.status_code, 302) location = urlparse.urlsplit(resp['location']).path self.assertEquals(urlparse.unquote(location), '/%s' % object_id)
def test_edit_view_saves_an_existing_instance(self, get_model_wiki_form): instance = Page.objects.create(title=get_unique_page_title(), content='test content') cleaned_data = fudge.Fake('CleanedData').provides('get').returns(None) fake_form = (fudge.Fake('Form').expects('is_valid').returns(True) .expects('save') .has_attr(cleaned_data=cleaned_data)) (get_model_wiki_form.is_callable() .returns_fake().is_callable() .returns(fake_form)) resp = self.client.post('/%s' % instance.pk, {'action': 'edit'}) self.assertEquals(resp.status_code, 302) location = urlparse.urlsplit(resp['location']).path self.assertEquals(urlparse.unquote(location), '/%s' % instance.pk)
def _extract_url_from_link(self, url): # parses out extra certificate stuff from urls in staging only return urlparse.unquote(re.search('\w+://.*/(\w+%3A//.*)', url).group(1))
def _extract_url_from_link(self, url): #parses out extra certificate stuff from urls in staging only return urlparse.unquote(re.search('\w+://.*/(\w+%3A//.*)', url).group(1))