Merge "Remove dead code and tests for staticweb."
This commit is contained in:
commit
66a0817e99
@ -152,7 +152,6 @@ class _StaticWebContext(WSGIContext):
|
||||
self.container = container
|
||||
self.obj = obj
|
||||
self.app = staticweb.app
|
||||
self.cache_timeout = staticweb.cache_timeout
|
||||
self.agent = '%(orig)s StaticWeb'
|
||||
# Results from the last call to self._get_container_info.
|
||||
self._index = self._error = self._listings = self._listings_css = \
|
||||
@ -447,8 +446,6 @@ class StaticWeb(object):
|
||||
self.app = app
|
||||
#: The filter configuration dict.
|
||||
self.conf = conf
|
||||
#: The seconds to cache the x-container-meta-web-* headers.,
|
||||
self.cache_timeout = int(conf.get('cache_timeout', 300))
|
||||
|
||||
def __call__(self, env, start_response):
|
||||
"""
|
||||
|
@ -24,34 +24,6 @@ from swift.common.swob import Request, Response
|
||||
from swift.common.middleware import staticweb
|
||||
|
||||
|
||||
class FakeMemcache(object):
|
||||
|
||||
def __init__(self):
|
||||
self.store = {}
|
||||
|
||||
def get(self, key):
|
||||
return self.store.get(key)
|
||||
|
||||
def set(self, key, value, time=0):
|
||||
self.store[key] = value
|
||||
return True
|
||||
|
||||
def incr(self, key, time=0):
|
||||
self.store[key] = self.store.setdefault(key, 0) + 1
|
||||
return self.store[key]
|
||||
|
||||
@contextmanager
|
||||
def soft_lock(self, key, timeout=0, retries=5):
|
||||
yield True
|
||||
|
||||
def delete(self, key):
|
||||
try:
|
||||
del self.store[key]
|
||||
except Exception:
|
||||
pass
|
||||
return True
|
||||
|
||||
|
||||
meta_map = {
|
||||
'c1': {'status': 401},
|
||||
'c2': {},
|
||||
@ -418,14 +390,6 @@ class TestStaticWeb(unittest.TestCase):
|
||||
sw = staticweb.filter_factory(conf)(FakeApp())
|
||||
self.assertEquals(sw.conf, conf)
|
||||
|
||||
def test_cache_timeout_unset(self):
|
||||
sw = staticweb.filter_factory({})(FakeApp())
|
||||
self.assertEquals(sw.cache_timeout, 300)
|
||||
|
||||
def test_cache_timeout_set(self):
|
||||
sw = staticweb.filter_factory({'cache_timeout': '1'})(FakeApp())
|
||||
self.assertEquals(sw.cache_timeout, 1)
|
||||
|
||||
def test_root(self):
|
||||
resp = Request.blank('/').get_response(self.test_staticweb)
|
||||
self.assertEquals(resp.status_int, 404)
|
||||
|
Loading…
x
Reference in New Issue
Block a user