当前位置: 首页>>代码示例>>Python>>正文


Python models.Url类代码示例

本文整理汇总了Python中linkcheck.models.Url的典型用法代码示例。如果您正苦于以下问题:Python Url类的具体用法?Python Url怎么用?Python Url使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Url类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_external_check_302_followed

 def test_external_check_302_followed(self):
     """
     For temporary redirects, we do not report any redirection in `redirect_to`.
     """
     uv = Url(url="%s/http/redirect/302/" % self.live_server_url, still_exists=True)
     uv.check_url()
     self.assertEqual(uv.status, True)
     self.assertEqual(uv.message, '200 OK')
     self.assertEqual(uv.redirect_to, '')
开发者ID:vignesh-msundaram,项目名称:django-linkcheck,代码行数:9,代码来源:test_linkcheck.py

示例2: test_internal_check_view_redirect

 def test_internal_check_view_redirect(self):
     uv = Url(url="/admin/linkcheck", still_exists=True)
     uv.check_url()
     self.assertEqual(uv.status, True)
     self.assertEqual(uv.message, 'This link redirects: code 301 (Working redirect)')
     uv = Url(url="/http/brokenredirect/", still_exists=True)
     uv.check_url()
     self.assertEqual(uv.status, False)
     redirect_code = 301 if django.VERSION < (1, 9) else 302
     self.assertEqual(uv.message, 'This link redirects: code %d (Broken redirect)' % redirect_code)
开发者ID:DjangoAdminHackers,项目名称:django-linkcheck,代码行数:10,代码来源:test_linkcheck.py

示例3: test_external_check_200_utf8

 def test_external_check_200_utf8(self):
     uv = Url(url="%s/http/200/r%%C3%%BCckmeldung/" % self.live_server_url, still_exists=True)
     uv.check_url()
     self.assertEqual(uv.status, True)
     self.assertEqual(uv.message, '200 OK')
     # Also when the url is not encoded
     uv = Url(url="%s/http/200/rückmeldung/" % self.live_server_url, still_exists=True)
     uv.check_url()
     self.assertEqual(uv.status, True)
     self.assertEqual(uv.message, '200 OK')
开发者ID:vignesh-msundaram,项目名称:django-linkcheck,代码行数:10,代码来源:test_linkcheck.py

示例4: test_internal_check_media_utf8

 def test_internal_check_media_utf8(self):
     uv = Url(url="/media/r%C3%BCckmeldung", still_exists=True)
     uv.check_url()
     self.assertEqual(uv.status, True)
     self.assertEqual(uv.message, 'Working file link')
     # Also when the url is not encoded
     uv = Url(url="/media/rückmeldung", still_exists=True)
     uv.check_url()
     self.assertEqual(uv.status, True)
     self.assertEqual(uv.message, 'Working file link')
开发者ID:vignesh-msundaram,项目名称:django-linkcheck,代码行数:10,代码来源:test_linkcheck.py

示例5: test_internal_check_media_utf8

 def test_internal_check_media_utf8(self):
     media_file = os.path.join(os.path.dirname(__file__), 'media', 'rückmeldung')
     open(media_file, 'a').close()
     self.addCleanup(os.remove, media_file)
     uv = Url(url="/media/r%C3%BCckmeldung", still_exists=True)
     uv.check_url()
     self.assertEqual(uv.status, True)
     self.assertEqual(uv.message, 'Working file link')
     # Also when the url is not encoded
     uv = Url(url="/media/rückmeldung", still_exists=True)
     uv.check_url()
     self.assertEqual(uv.status, True)
     self.assertEqual(uv.message, 'Working file link')
开发者ID:DjangoAdminHackers,项目名称:django-linkcheck,代码行数:13,代码来源:test_linkcheck.py

示例6: test_external_check_404

 def test_external_check_404(self):
     uv = Url(url="http://qa-dev.w3.org/link-testsuite/http.php?code=404", still_exists=True)
     uv.check()
     self.assertEquals(uv.status, False)
     self.assertEquals(uv.message, '404 Not Found')
开发者ID:vishalsodani,项目名称:django-linkcheck,代码行数:5,代码来源:__init__.py

示例7: test_external_check_301

 def test_external_check_301(self):
     uv = Url(url="http://qa-dev.w3.org/link-testsuite/http.php?code=301", still_exists=True)
     uv.check()
     self.assertEquals(uv.status, False)
     self.assertEquals(uv.message, '301 Moved Permanently')
开发者ID:vishalsodani,项目名称:django-linkcheck,代码行数:5,代码来源:__init__.py

示例8: test_external_check_200

 def test_external_check_200(self):
     uv = Url(url="http://qa-dev.w3.org/link-testsuite/http.php?code=200", still_exists=True)
     uv.check()
     self.assertEquals(uv.status, True)
     self.assertEquals(uv.message, '200 OK')
开发者ID:vishalsodani,项目名称:django-linkcheck,代码行数:5,代码来源:__init__.py

示例9: test_internal_check_media_utf8

 def test_internal_check_media_utf8(self):
     uv = Url(url="/media/r%C3%BCckmeldung", still_exists=True)
     uv.check()
     self.assertEquals(uv.status, True)
     self.assertEquals(uv.message, 'Working file link')
开发者ID:vishalsodani,项目名称:django-linkcheck,代码行数:5,代码来源:__init__.py

示例10: test_internal_check_broken_internal_link

 def test_internal_check_broken_internal_link(self):
     uv = Url(url="/broken/internal/link", still_exists=True)
     uv.check()
     self.assertEquals(uv.status, False)
     self.assertEquals(uv.message, 'Broken internal link')
开发者ID:vishalsodani,项目名称:django-linkcheck,代码行数:5,代码来源:__init__.py

示例11: test_internal_check_anchor

 def test_internal_check_anchor(self):
     uv = Url(url="#some_anchor", still_exists=True)
     uv.check()
     self.assertEquals(uv.status, None)
     self.assertEquals(uv.message, 'Link to within the same page (not automatically checked)')
开发者ID:vishalsodani,项目名称:django-linkcheck,代码行数:5,代码来源:__init__.py

示例12: test_external_check_404

 def test_external_check_404(self):
     uv = Url(url="%s/whatever/" % self.live_server_url, still_exists=True)
     uv.check_url()
     self.assertEqual(uv.status, False)
     self.assertEqual(uv.message.lower(), '404 not found')
开发者ID:vignesh-msundaram,项目名称:django-linkcheck,代码行数:5,代码来源:test_linkcheck.py

示例13: test_external_check_301_followed

 def test_external_check_301_followed(self):
     uv = Url(url="%s/http/redirect/301/" % self.live_server_url, still_exists=True)
     uv.check_url()
     self.assertEqual(uv.status, True)
     self.assertEqual(uv.message, '301 OK')
     self.assertEqual(uv.redirect_to, '%s/http/200/' % self.live_server_url)
开发者ID:vignesh-msundaram,项目名称:django-linkcheck,代码行数:6,代码来源:test_linkcheck.py

示例14: test_external_check_301

 def test_external_check_301(self):
     uv = Url(url="%s/http/301/" % self.live_server_url, still_exists=True)
     uv.check_url()
     self.assertEqual(uv.status, False)
     self.assertEqual(uv.message.lower(), '301 moved permanently')
开发者ID:vignesh-msundaram,项目名称:django-linkcheck,代码行数:5,代码来源:test_linkcheck.py

示例15: test_external_check_200

 def test_external_check_200(self):
     uv = Url(url="%s/http/200/" % self.live_server_url, still_exists=True)
     uv.check_url()
     self.assertEqual(uv.status, True)
     self.assertEqual(uv.message, '200 OK')
     self.assertEqual(uv.redirect_to, '')
开发者ID:vignesh-msundaram,项目名称:django-linkcheck,代码行数:6,代码来源:test_linkcheck.py


注:本文中的linkcheck.models.Url类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。