本文整理汇总了Python中django.contrib.staticfiles.testing.StaticLiveServerTestCase方法的典型用法代码示例。如果您正苦于以下问题:Python testing.StaticLiveServerTestCase方法的具体用法?Python testing.StaticLiveServerTestCase怎么用?Python testing.StaticLiveServerTestCase使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类django.contrib.staticfiles.testing
的用法示例。
在下文中一共展示了testing.StaticLiveServerTestCase方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: url
# 需要导入模块: from django.contrib.staticfiles import testing [as 别名]
# 或者: from django.contrib.staticfiles.testing import StaticLiveServerTestCase [as 别名]
def url(self, path):
# Construct a URL to the desired page. Use self.live_server_url
# (set by StaticLiveServerTestCase) to determine the scheme, hostname,
# and port the test server is running on. Add the path.
import urllib.parse
return urllib.parse.urljoin(self.live_server_url, path)
示例2: setUpClass
# 需要导入模块: from django.contrib.staticfiles import testing [as 别名]
# 或者: from django.contrib.staticfiles.testing import StaticLiveServerTestCase [as 别名]
def setUpClass(cls):
super(StaticLiveServerTestCase, cls).setUpClass()
cls.setup_browser()
cls.setup_data()
示例3: test_collectstatic_emulation
# 需要导入模块: from django.contrib.staticfiles import testing [as 别名]
# 或者: from django.contrib.staticfiles.testing import StaticLiveServerTestCase [as 别名]
def test_collectstatic_emulation(self):
"""
StaticLiveServerTestCase use of staticfiles' serve() allows it
to discover app's static assets without having to collectstatic first.
"""
with self.urlopen('/static/test/file.txt') as f:
self.assertEqual(f.read().rstrip(b'\r\n'), b'In static directory.')