summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCasey Duncan <casey.duncan@gmail.com>2015-04-15 15:01:18 -0400
committerCasey Duncan <casey.duncan@gmail.com>2015-04-15 15:01:18 -0400
commit611aa33342653d5ead73473703f4aad8680ed0df (patch)
tree7447d795f917b03fdff82d8acc0ebacd648e2b54
parent46497335df6e87ce681f3e05b82ca5ff32d57f32 (diff)
downloadpyramid-611aa33342653d5ead73473703f4aad8680ed0df.tar.gz
pyramid-611aa33342653d5ead73473703f4aad8680ed0df.tar.bz2
pyramid-611aa33342653d5ead73473703f4aad8680ed0df.zip
moar deriver test fixes
-rw-r--r--pyramid/tests/test_config/test_derivations.py23
1 files changed, 18 insertions, 5 deletions
diff --git a/pyramid/tests/test_config/test_derivations.py b/pyramid/tests/test_config/test_derivations.py
index 668a462b1..bda85b00a 100644
--- a/pyramid/tests/test_config/test_derivations.py
+++ b/pyramid/tests/test_config/test_derivations.py
@@ -966,12 +966,12 @@ class TestDeriveView(unittest.TestCase):
def test_attr_wrapped_view_branching_default_phash(self):
from pyramid.config.util import DEFAULT_PHASH
def view(context, request): pass
- result = self.config.derive_view(view, phash=DEFAULT_PHASH)
+ result = self.config._derive_view(view, phash=DEFAULT_PHASH)
self.assertEqual(result.__wraps__, view)
def test_attr_wrapped_view_branching_nondefault_phash(self):
def view(context, request): pass
- result = self.config.derive_view(view, phash='nondefault')
+ result = self.config._derive_view(view, phash='nondefault')
self.assertNotEqual(result, view)
def test_http_cached_view_integer(self):
@@ -980,7 +980,7 @@ class TestDeriveView(unittest.TestCase):
response = Response('OK')
def inner_view(context, request):
return response
- result = self.config.derive_view(inner_view, http_cache=3600)
+ result = self.config._derive_view(inner_view, http_cache=3600)
self.assertFalse(result is inner_view)
self.assertEqual(inner_view.__module__, result.__module__)
self.assertEqual(inner_view.__doc__, result.__doc__)
@@ -999,7 +999,7 @@ class TestDeriveView(unittest.TestCase):
response = Response('OK')
def inner_view(context, request):
return response
- result = self.config.derive_view(inner_view,
+ result = self.config._derive_view(inner_view,
http_cache=datetime.timedelta(hours=1))
self.assertFalse(result is inner_view)
self.assertEqual(inner_view.__module__, result.__module__)
@@ -1019,7 +1019,7 @@ class TestDeriveView(unittest.TestCase):
response = Response('OK')
def inner_view(context, request):
return response
- result = self.config.derive_view(inner_view,
+ result = self.config._derive_view(inner_view,
http_cache=(3600, {'public':True}))
self.assertFalse(result is inner_view)
self.assertEqual(inner_view.__module__, result.__module__)
@@ -1126,3 +1126,16 @@ class DummySecurityPolicy:
def permits(self, context, principals, permission):
return self.permitted
+def parse_httpdate(s):
+ import datetime
+ # cannot use %Z, must use literal GMT; Jython honors timezone
+ # but CPython does not
+ return datetime.datetime.strptime(s, "%a, %d %b %Y %H:%M:%S GMT")
+
+def assert_similar_datetime(one, two):
+ for attr in ('year', 'month', 'day', 'hour', 'minute'):
+ one_attr = getattr(one, attr)
+ two_attr = getattr(two, attr)
+ if not one_attr == two_attr: # pragma: no cover
+ raise AssertionError('%r != %r in %s' % (one_attr, two_attr, attr))
+