Commits

Eric Larson committed f341cc2

Summary: Removed unneccessy tests that started a server. These are covered in the mocked tests
Author: Eric Larson <eric@ionrock.org>

Comments (0)

Files changed (2)

httpcache/tests/integration/test_caching_conditions.py

-from httpcache import CacheControl
-import requests
-
-
-class TestCachingConditions(object):
-
-    def test_no_caching_directives(self):
-        url = 'http://localhost:8080/'
-        s = requests.Session()
-        c = CacheControl(s, {})
-        r = c.get(url)
-
-        assert r
-        assert r.content == 'foo'
-        assert not c.cache.get(url)
-
-    def test_cache_max_age(self):
-        url = 'http://localhost:8080/max_age/'
-        s = requests.Session()
-        c = CacheControl(s, {})
-        r = c.get(url)
-        assert c.cache.get(url)
-        assert c.cache.get(url) == r
-
-    def test_cache_no_cache(self):
-        url = 'http://localhost:8080/no_cache/'
-        s = requests.Session()
-        c = CacheControl(s, {})
-        c.get(url)
-        assert not c.cache.get(url)
-
-    def test_cache_must_revalidate(self):
-        url = 'http://localhost:8080/must_revalidate/'
-        s = requests.Session()
-        c = CacheControl(s, {})
-        c.get(url)
-        assert not c.cache.get(url)
-
-    def test_cache_no_store(self):
-        url = 'http://localhost:8080/no_store/'
-        s = requests.Session()
-        c = CacheControl(s, {})
-        c.get(url)
-        assert not c.cache.get(url)

httpcache/tests/server.py

-from __future__ import print_function
-import cherrypy
-
-
-class CacheTestingServer(object):
-
-    def index(self):
-        return 'foo'
-    index.exposed = True
-
-    def max_age(self, value=None):
-        age = 'max-age=%s' % (value or 300)
-        cherrypy.response.headers['Cache-Control'] = age
-        return 'max age'
-    max_age.exposed = True
-
-    def no_cache(self):
-        cherrypy.response.headers['Cache-Control'] = 'no-cache'
-        return 'no cache'
-    no_cache.exposed = True
-
-    def must_revalidate(self):
-        cherrypy.response.headers['Cache-Control'] = 'must-revalidate'
-        return 'must revalidate'
-    must_revalidate.exposed = True
-
-    def no_store(self):
-        cherrypy.response.headers['Cache-Control'] = 'no-store'
-        return 'no store'
-    no_store.exposed = True
-
-
-if __name__ == '__main__':
-    cherrypy.tree.mount(CacheTestingServer(), '/')
-    cherrypy.engine.start()
-    cherrypy.engine.block()