annotate MoinMoin/action/_tests/test_sendcached.py @ 3812:30ed528054ed

fix some pep8 failures
author Johannes Berg <johannes AT sipsolutions DOT net>
date Wed, 02 Jul 2008 01:05:09 +0200
parents 738bd5aec961
children 712e5938ec59
rev   line source
3799
738bd5aec961 sendcached: minor bugfix, added unit tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
1 # -*- coding: iso-8859-1 -*-
738bd5aec961 sendcached: minor bugfix, added unit tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
2 """
738bd5aec961 sendcached: minor bugfix, added unit tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
3 MoinMoin - tests of sendcached functions
738bd5aec961 sendcached: minor bugfix, added unit tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
4
738bd5aec961 sendcached: minor bugfix, added unit tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
5 @copyright: 2008 MoinMoin:ThomasWaldmann
738bd5aec961 sendcached: minor bugfix, added unit tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
6 @license: GNU GPL, see COPYING for details.
738bd5aec961 sendcached: minor bugfix, added unit tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
7 """
738bd5aec961 sendcached: minor bugfix, added unit tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
8
738bd5aec961 sendcached: minor bugfix, added unit tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
9 import os, StringIO
738bd5aec961 sendcached: minor bugfix, added unit tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
10
738bd5aec961 sendcached: minor bugfix, added unit tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
11 from MoinMoin import caching
738bd5aec961 sendcached: minor bugfix, added unit tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
12 from MoinMoin.action import sendcached
738bd5aec961 sendcached: minor bugfix, added unit tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
13
738bd5aec961 sendcached: minor bugfix, added unit tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
14 from MoinMoin._tests import become_trusted, create_page, nuke_page
738bd5aec961 sendcached: minor bugfix, added unit tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
15
738bd5aec961 sendcached: minor bugfix, added unit tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
16 class TestSendCached:
738bd5aec961 sendcached: minor bugfix, added unit tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
17 """ testing action sendcached """
738bd5aec961 sendcached: minor bugfix, added unit tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
18 pagename = u"AutoCreatedSillyPageToTestAttachments"
738bd5aec961 sendcached: minor bugfix, added unit tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
19
738bd5aec961 sendcached: minor bugfix, added unit tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
20 def test_put_cache_minimal(self):
738bd5aec961 sendcached: minor bugfix, added unit tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
21 """Test if put_cache() works"""
738bd5aec961 sendcached: minor bugfix, added unit tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
22 request = self.request
738bd5aec961 sendcached: minor bugfix, added unit tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
23 key = 'nooneknowsit'
738bd5aec961 sendcached: minor bugfix, added unit tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
24 data = "dontcare"
738bd5aec961 sendcached: minor bugfix, added unit tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
25 url = sendcached.put_cache(request, key, data)
738bd5aec961 sendcached: minor bugfix, added unit tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
26
738bd5aec961 sendcached: minor bugfix, added unit tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
27 assert key in url
738bd5aec961 sendcached: minor bugfix, added unit tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
28 meta_cache = caching.CacheEntry(request,
738bd5aec961 sendcached: minor bugfix, added unit tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
29 arena=sendcached.sendcached_arena,
738bd5aec961 sendcached: minor bugfix, added unit tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
30 scope=sendcached.sendcached_scope,
738bd5aec961 sendcached: minor bugfix, added unit tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
31 key=key+'.meta', use_pickle=True)
738bd5aec961 sendcached: minor bugfix, added unit tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
32 last_modified, headers = meta_cache.content()
738bd5aec961 sendcached: minor bugfix, added unit tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
33 assert last_modified.endswith(' GMT') # only a very rough check, it has used cache mtime as last_modified
738bd5aec961 sendcached: minor bugfix, added unit tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
34 assert "Content-Type: application/octet-stream" in headers
738bd5aec961 sendcached: minor bugfix, added unit tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
35 assert "Content-Length: %d" % len(data) in headers
738bd5aec961 sendcached: minor bugfix, added unit tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
36
738bd5aec961 sendcached: minor bugfix, added unit tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
37 def test_put_cache_guess_ct_give_lm(self):
738bd5aec961 sendcached: minor bugfix, added unit tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
38 """Test if put_cache() works, when we give filename (so it guesses content_type) and last_modified"""
738bd5aec961 sendcached: minor bugfix, added unit tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
39 request = self.request
738bd5aec961 sendcached: minor bugfix, added unit tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
40 key = 'nooneknowsit'
738bd5aec961 sendcached: minor bugfix, added unit tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
41 filename = "test.png"
738bd5aec961 sendcached: minor bugfix, added unit tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
42 data = "dontcare"
738bd5aec961 sendcached: minor bugfix, added unit tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
43 url = sendcached.put_cache(request, key, data,
738bd5aec961 sendcached: minor bugfix, added unit tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
44 filename=filename, last_modified=1)
738bd5aec961 sendcached: minor bugfix, added unit tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
45 assert key in url
738bd5aec961 sendcached: minor bugfix, added unit tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
46
738bd5aec961 sendcached: minor bugfix, added unit tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
47 meta_cache = caching.CacheEntry(request,
738bd5aec961 sendcached: minor bugfix, added unit tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
48 arena=sendcached.sendcached_arena,
738bd5aec961 sendcached: minor bugfix, added unit tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
49 scope=sendcached.sendcached_scope,
738bd5aec961 sendcached: minor bugfix, added unit tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
50 key=key+'.meta', use_pickle=True)
738bd5aec961 sendcached: minor bugfix, added unit tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
51 last_modified, headers = meta_cache.content()
738bd5aec961 sendcached: minor bugfix, added unit tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
52 assert last_modified == 'Thu, 01 Jan 1970 00:00:01 GMT'
738bd5aec961 sendcached: minor bugfix, added unit tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
53 assert "Content-Type: image/png" in headers
738bd5aec961 sendcached: minor bugfix, added unit tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
54 assert "Content-Length: %d" % len(data) in headers
738bd5aec961 sendcached: minor bugfix, added unit tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
55
738bd5aec961 sendcached: minor bugfix, added unit tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
56 def test_put_cache_file_like_data(self):
738bd5aec961 sendcached: minor bugfix, added unit tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
57 """Test if put_cache() works when we give it a file like object for the content"""
738bd5aec961 sendcached: minor bugfix, added unit tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
58 request = self.request
738bd5aec961 sendcached: minor bugfix, added unit tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
59 key = 'nooneknowsit'
738bd5aec961 sendcached: minor bugfix, added unit tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
60 filename = "test.png"
738bd5aec961 sendcached: minor bugfix, added unit tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
61 data = "dontcareatall"
738bd5aec961 sendcached: minor bugfix, added unit tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
62 data_file = StringIO.StringIO(data)
738bd5aec961 sendcached: minor bugfix, added unit tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
63 url = sendcached.put_cache(request, key, data_file)
738bd5aec961 sendcached: minor bugfix, added unit tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
64
738bd5aec961 sendcached: minor bugfix, added unit tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
65 assert key in url
738bd5aec961 sendcached: minor bugfix, added unit tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
66 meta_cache = caching.CacheEntry(request,
738bd5aec961 sendcached: minor bugfix, added unit tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
67 arena=sendcached.sendcached_arena,
738bd5aec961 sendcached: minor bugfix, added unit tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
68 scope=sendcached.sendcached_scope,
738bd5aec961 sendcached: minor bugfix, added unit tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
69 key=key+'.meta', use_pickle=True)
738bd5aec961 sendcached: minor bugfix, added unit tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
70 last_modified, headers = meta_cache.content()
738bd5aec961 sendcached: minor bugfix, added unit tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
71 assert last_modified.endswith(' GMT') # only a very rough check, it has used cache mtime as last_modified
738bd5aec961 sendcached: minor bugfix, added unit tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
72 assert "Content-Type: application/octet-stream" in headers
738bd5aec961 sendcached: minor bugfix, added unit tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
73 assert "Content-Length: %d" % len(data) in headers
738bd5aec961 sendcached: minor bugfix, added unit tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
74
738bd5aec961 sendcached: minor bugfix, added unit tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
75 data_cache = caching.CacheEntry(request,
738bd5aec961 sendcached: minor bugfix, added unit tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
76 arena=sendcached.sendcached_arena,
738bd5aec961 sendcached: minor bugfix, added unit tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
77 scope=sendcached.sendcached_scope,
738bd5aec961 sendcached: minor bugfix, added unit tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
78 key=key+'.data')
738bd5aec961 sendcached: minor bugfix, added unit tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
79 cached = data_cache.content()
738bd5aec961 sendcached: minor bugfix, added unit tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
80 assert data == cached
738bd5aec961 sendcached: minor bugfix, added unit tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
81
738bd5aec961 sendcached: minor bugfix, added unit tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
82 def test_put_cache_complex(self):
738bd5aec961 sendcached: minor bugfix, added unit tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
83 """Test if put_cache() works for a more complex, practical scenario:
3812
30ed528054ed fix some pep8 failures
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3799
diff changeset
84
3799
738bd5aec961 sendcached: minor bugfix, added unit tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
85 As 'source' we just use some random integer as count value.
738bd5aec961 sendcached: minor bugfix, added unit tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
86
738bd5aec961 sendcached: minor bugfix, added unit tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
87 The 'rendered representation' of it is just the word "spam" repeated
738bd5aec961 sendcached: minor bugfix, added unit tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
88 count times, which we cache.
738bd5aec961 sendcached: minor bugfix, added unit tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
89
738bd5aec961 sendcached: minor bugfix, added unit tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
90 The cache key calculation (for the 'non-guessable' keys) is also
738bd5aec961 sendcached: minor bugfix, added unit tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
91 rather simple.
738bd5aec961 sendcached: minor bugfix, added unit tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
92
3812
30ed528054ed fix some pep8 failures
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3799
diff changeset
93 In real world, source would be likely some big image, rendered
3799
738bd5aec961 sendcached: minor bugfix, added unit tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
94 representation of it a thumbnail / preview of it. Or some LaTeX
738bd5aec961 sendcached: minor bugfix, added unit tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
95 source and its rendered representation as png image.
738bd5aec961 sendcached: minor bugfix, added unit tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
96 Key calculation could be some MAC or some other hard to guess and
738bd5aec961 sendcached: minor bugfix, added unit tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
97 unique string.
738bd5aec961 sendcached: minor bugfix, added unit tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
98 """
738bd5aec961 sendcached: minor bugfix, added unit tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
99 import random
738bd5aec961 sendcached: minor bugfix, added unit tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
100 request = self.request
738bd5aec961 sendcached: minor bugfix, added unit tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
101 render = lambda data: "spam" * data
738bd5aec961 sendcached: minor bugfix, added unit tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
102 secret = 4223
738bd5aec961 sendcached: minor bugfix, added unit tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
103 keycalc = lambda data: str(data * secret)
738bd5aec961 sendcached: minor bugfix, added unit tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
104
738bd5aec961 sendcached: minor bugfix, added unit tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
105 source = random.randint(1, 100)
738bd5aec961 sendcached: minor bugfix, added unit tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
106 rendered1 = render(source)
738bd5aec961 sendcached: minor bugfix, added unit tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
107 key1 = keycalc(source)
738bd5aec961 sendcached: minor bugfix, added unit tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
108
738bd5aec961 sendcached: minor bugfix, added unit tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
109 url1 = sendcached.put_cache(request, key1, rendered1)
738bd5aec961 sendcached: minor bugfix, added unit tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
110 assert 'key=%s' % key1 in url1
738bd5aec961 sendcached: minor bugfix, added unit tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
111
738bd5aec961 sendcached: minor bugfix, added unit tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
112 data_cache = caching.CacheEntry(request,
738bd5aec961 sendcached: minor bugfix, added unit tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
113 arena=sendcached.sendcached_arena,
738bd5aec961 sendcached: minor bugfix, added unit tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
114 scope=sendcached.sendcached_scope,
738bd5aec961 sendcached: minor bugfix, added unit tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
115 key=key1+'.data')
738bd5aec961 sendcached: minor bugfix, added unit tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
116 cached1 = data_cache.content()
738bd5aec961 sendcached: minor bugfix, added unit tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
117
738bd5aec961 sendcached: minor bugfix, added unit tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
118 assert render(source) == cached1
738bd5aec961 sendcached: minor bugfix, added unit tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
119 # if that succeeds, we have stored the rendered representation of source in the cache under key1
738bd5aec961 sendcached: minor bugfix, added unit tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
120
738bd5aec961 sendcached: minor bugfix, added unit tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
121 # now we use some different source, render it and store it in the cache
738bd5aec961 sendcached: minor bugfix, added unit tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
122 source = source * 2
738bd5aec961 sendcached: minor bugfix, added unit tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
123 rendered2 = render(source)
738bd5aec961 sendcached: minor bugfix, added unit tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
124 key2 = keycalc(source)
738bd5aec961 sendcached: minor bugfix, added unit tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
125
738bd5aec961 sendcached: minor bugfix, added unit tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
126 url2 = sendcached.put_cache(request, key2, rendered2)
738bd5aec961 sendcached: minor bugfix, added unit tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
127 assert 'key=%s' % key2 in url2
738bd5aec961 sendcached: minor bugfix, added unit tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
128
738bd5aec961 sendcached: minor bugfix, added unit tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
129 data_cache = caching.CacheEntry(request,
738bd5aec961 sendcached: minor bugfix, added unit tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
130 arena=sendcached.sendcached_arena,
738bd5aec961 sendcached: minor bugfix, added unit tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
131 scope=sendcached.sendcached_scope,
738bd5aec961 sendcached: minor bugfix, added unit tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
132 key=key2+'.data')
738bd5aec961 sendcached: minor bugfix, added unit tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
133 cached2 = data_cache.content()
738bd5aec961 sendcached: minor bugfix, added unit tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
134
738bd5aec961 sendcached: minor bugfix, added unit tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
135 assert render(source) == cached2
738bd5aec961 sendcached: minor bugfix, added unit tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
136 # if that succeeds, we have stored the rendered representation of updated source in the cache under key2
738bd5aec961 sendcached: minor bugfix, added unit tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
137
738bd5aec961 sendcached: minor bugfix, added unit tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
138 assert url2 != url1 # URLs must be different for different source (implies different keys)
738bd5aec961 sendcached: minor bugfix, added unit tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
139
738bd5aec961 sendcached: minor bugfix, added unit tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
140
738bd5aec961 sendcached: minor bugfix, added unit tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
141 coverage_modules = ['MoinMoin.action.sendcached']
738bd5aec961 sendcached: minor bugfix, added unit tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
142