changeset 3897:78c452cf0257

fix tests, PEP8
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Sun, 20 Jul 2008 18:30:51 +0200
parents a0babca35e5d
children 7fa289e48089
files MoinMoin/_tests/test_packages.py MoinMoin/action/_tests/test_cache.py MoinMoin/action/cache.py
diffstat 3 files changed, 15 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/_tests/test_packages.py	Sun Jul 20 18:12:39 2008 +0200
+++ b/MoinMoin/_tests/test_packages.py	Sun Jul 20 18:30:51 2008 +0200
@@ -84,11 +84,9 @@
 
 class TestRealCreation:
 
-    def testSearchCreate(self):
+    def testSearch(self):
         package = PackagePages(self.request.rootpage.page_name, self.request)
-        temp = tempfile.NamedTemporaryFile(suffix='.zip')
-        package.collectpackage(package.searchpackage(self.request, "Category"), temp)
-        assert zipfile.is_zipfile(temp.name)
+        assert package.searchpackage(self.request, "Bad") == [u'BadContent']
 
     def testListCreate(self):
         package = PackagePages(self.request.rootpage.page_name, self.request)
--- a/MoinMoin/action/_tests/test_cache.py	Sun Jul 20 18:12:39 2008 +0200
+++ b/MoinMoin/action/_tests/test_cache.py	Sun Jul 20 18:30:51 2008 +0200
@@ -68,10 +68,10 @@
                                         arena=cache.cache_arena,
                                         scope=cache.cache_scope,
                                         key=key+'.meta', use_pickle=True)
-        last_modified, headers = meta_cache.content()
-        assert last_modified.endswith(' GMT') # only a very rough check, it has used cache mtime as last_modified
-        assert "Content-Type: application/octet-stream" in headers
-        assert "Content-Length: %d" % len(data) in headers
+        meta = meta_cache.content()
+        assert meta['httpdate_last_modified'].endswith(' GMT') # only a very rough check, it has used cache mtime as last_modified
+        assert "Content-Type: application/octet-stream" in meta['headers']
+        assert "Content-Length: %d" % len(data) in meta['headers']
 
     def test_put_cache_guess_ct_give_lm(self):
         """Test if put_cache() works, when we give filename (so it guesses content_type) and last_modified"""
@@ -87,10 +87,10 @@
                                         arena=cache.cache_arena,
                                         scope=cache.cache_scope,
                                         key=key+'.meta', use_pickle=True)
-        last_modified, headers = meta_cache.content()
-        assert last_modified == 'Thu, 01 Jan 1970 00:00:01 GMT'
-        assert "Content-Type: image/png" in headers
-        assert "Content-Length: %d" % len(data) in headers
+        meta = meta_cache.content()
+        assert meta['httpdate_last_modified'] == 'Thu, 01 Jan 1970 00:00:01 GMT'
+        assert "Content-Type: image/png" in meta['headers']
+        assert "Content-Length: %d" % len(data) in meta['headers']
 
     def test_put_cache_file_like_data(self):
         """Test if put_cache() works when we give it a file like object for the content"""
@@ -107,10 +107,10 @@
                                         arena=cache.cache_arena,
                                         scope=cache.cache_scope,
                                         key=key+'.meta', use_pickle=True)
-        last_modified, headers = meta_cache.content()
-        assert last_modified.endswith(' GMT') # only a very rough check, it has used cache mtime as last_modified
-        assert "Content-Type: application/octet-stream" in headers
-        assert "Content-Length: %d" % len(data) in headers
+        meta = meta_cache.content()
+        assert meta['httpdate_last_modified'].endswith(' GMT') # only a very rough check, it has used cache mtime as last_modified
+        assert "Content-Type: application/octet-stream" in meta['headers']
+        assert "Content-Length: %d" % len(data) in meta['headers']
 
         data_cache = caching.CacheEntry(request,
                                         arena=cache.cache_arena,
--- a/MoinMoin/action/cache.py	Sun Jul 20 18:12:39 2008 +0200
+++ b/MoinMoin/action/cache.py	Sun Jul 20 18:30:51 2008 +0200
@@ -162,7 +162,7 @@
         'httpdate_last_modified': httpdate_last_modified,
         'last_modified': last_modified,
         'headers': headers,
-        'original':original,
+        'original': original,
     })