Python django.contrib.staticfiles.testing.StaticLiveServerTestCase() Examples

The following are 4 code examples of django.contrib.staticfiles.testing.StaticLiveServerTestCase(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module django.contrib.staticfiles.testing , or try the search function .
Example #1
Source File: tests.py    From govready-q with GNU General Public License v3.0 5 votes vote down vote up
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) 
Example #2
Source File: tests.py    From govready-q with GNU General Public License v3.0 5 votes vote down vote up
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) 
Example #3
Source File: test_frontend.py    From callisto-core with GNU Affero General Public License v3.0 5 votes vote down vote up
def setUpClass(cls):
        super(StaticLiveServerTestCase, cls).setUpClass()
        cls.setup_browser()
        cls.setup_data() 
Example #4
Source File: test_liveserver.py    From djongo with GNU Affero General Public License v3.0 5 votes vote down vote up
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.')