1 | Sun Jul 11 21:02:52 GMT Daylight Time 2010 david-sarah@jacaranda.org |
---|
2 | * Add tests of caps from the future that have non-ASCII characters in them (encoded as UTF-8). The changes to test_uri.py, test_client.py, and test_dirnode.py add tests of non-ASCII future caps in addition to the current tests. The changes to test_web.py just replace the tests of all-ASCII future caps with tests of non-ASCII future caps. We also change uses of failUnlessEqual to failUnlessReallyEqual, in order to catch cases where the type of a string is not as expected. |
---|
3 | |
---|
4 | New patches: |
---|
5 | |
---|
6 | [Add tests of caps from the future that have non-ASCII characters in them (encoded as UTF-8). The changes to test_uri.py, test_client.py, and test_dirnode.py add tests of non-ASCII future caps in addition to the current tests. The changes to test_web.py just replace the tests of all-ASCII future caps with tests of non-ASCII future caps. We also change uses of failUnlessEqual to failUnlessReallyEqual, in order to catch cases where the type of a string is not as expected. |
---|
7 | david-sarah@jacaranda.org**20100711200252 |
---|
8 | Ignore-this: c2f193352369d32e06865f8f3e951894 |
---|
9 | ] { |
---|
10 | hunk ./src/allmydata/test/test_client.py 30 |
---|
11 | "introducer.furl = \n" |
---|
12 | ) |
---|
13 | |
---|
14 | -class Basic(unittest.TestCase): |
---|
15 | +class Basic(testutil.ReallyEqualMixin, unittest.TestCase): |
---|
16 | def test_loadable(self): |
---|
17 | basedir = "test_client.Basic.test_loadable" |
---|
18 | os.mkdir(basedir) |
---|
19 | hunk ./src/allmydata/test/test_client.py 84 |
---|
20 | f.write("reserved_space = 1000\n") |
---|
21 | f.close() |
---|
22 | c = client.Client(basedir) |
---|
23 | - self.failUnlessEqual(c.getServiceNamed("storage").reserved_space, 1000) |
---|
24 | + self.failUnlessReallyEqual(c.getServiceNamed("storage").reserved_space, 1000) |
---|
25 | |
---|
26 | def test_reserved_2(self): |
---|
27 | basedir = "client.Basic.test_reserved_2" |
---|
28 | hunk ./src/allmydata/test/test_client.py 96 |
---|
29 | f.write("reserved_space = 10K\n") |
---|
30 | f.close() |
---|
31 | c = client.Client(basedir) |
---|
32 | - self.failUnlessEqual(c.getServiceNamed("storage").reserved_space, 10*1000) |
---|
33 | + self.failUnlessReallyEqual(c.getServiceNamed("storage").reserved_space, 10*1000) |
---|
34 | |
---|
35 | def test_reserved_3(self): |
---|
36 | basedir = "client.Basic.test_reserved_3" |
---|
37 | hunk ./src/allmydata/test/test_client.py 108 |
---|
38 | f.write("reserved_space = 5mB\n") |
---|
39 | f.close() |
---|
40 | c = client.Client(basedir) |
---|
41 | - self.failUnlessEqual(c.getServiceNamed("storage").reserved_space, |
---|
42 | + self.failUnlessReallyEqual(c.getServiceNamed("storage").reserved_space, |
---|
43 | 5*1000*1000) |
---|
44 | |
---|
45 | def test_reserved_4(self): |
---|
46 | hunk ./src/allmydata/test/test_client.py 121 |
---|
47 | f.write("reserved_space = 78Gb\n") |
---|
48 | f.close() |
---|
49 | c = client.Client(basedir) |
---|
50 | - self.failUnlessEqual(c.getServiceNamed("storage").reserved_space, |
---|
51 | - 78*1000*1000*1000) |
---|
52 | + self.failUnlessReallyEqual(c.getServiceNamed("storage").reserved_space, |
---|
53 | + 78*1000*1000*1000) |
---|
54 | |
---|
55 | def test_reserved_bad(self): |
---|
56 | basedir = "client.Basic.test_reserved_bad" |
---|
57 | hunk ./src/allmydata/test/test_client.py 134 |
---|
58 | f.write("reserved_space = bogus\n") |
---|
59 | f.close() |
---|
60 | c = client.Client(basedir) |
---|
61 | - self.failUnlessEqual(c.getServiceNamed("storage").reserved_space, 0) |
---|
62 | + self.failUnlessReallyEqual(c.getServiceNamed("storage").reserved_space, 0) |
---|
63 | |
---|
64 | def _permute(self, sb, key): |
---|
65 | return [ peerid |
---|
66 | hunk ./src/allmydata/test/test_client.py 145 |
---|
67 | for k in ["%d" % i for i in range(5)]: |
---|
68 | sb.test_add_server(k, None) |
---|
69 | |
---|
70 | - self.failUnlessEqual(self._permute(sb, "one"), ['3','1','0','4','2']) |
---|
71 | - self.failUnlessEqual(self._permute(sb, "two"), ['0','4','2','1','3']) |
---|
72 | + self.failUnlessReallyEqual(self._permute(sb, "one"), ['3','1','0','4','2']) |
---|
73 | + self.failUnlessReallyEqual(self._permute(sb, "two"), ['0','4','2','1','3']) |
---|
74 | sb.test_servers.clear() |
---|
75 | hunk ./src/allmydata/test/test_client.py 148 |
---|
76 | - self.failUnlessEqual(self._permute(sb, "one"), []) |
---|
77 | + self.failUnlessReallyEqual(self._permute(sb, "one"), []) |
---|
78 | |
---|
79 | def test_versions(self): |
---|
80 | basedir = "test_client.Basic.test_versions" |
---|
81 | hunk ./src/allmydata/test/test_client.py 157 |
---|
82 | c = client.Client(basedir) |
---|
83 | ss = c.getServiceNamed("storage") |
---|
84 | verdict = ss.remote_get_version() |
---|
85 | - self.failUnlessEqual(verdict["application-version"], |
---|
86 | - str(allmydata.__full_version__)) |
---|
87 | + self.failUnlessReallyEqual(verdict["application-version"], |
---|
88 | + str(allmydata.__full_version__)) |
---|
89 | self.failIfEqual(str(allmydata.__version__), "unknown") |
---|
90 | self.failUnless("." in str(allmydata.__full_version__), |
---|
91 | "non-numeric version in '%s'" % allmydata.__version__) |
---|
92 | hunk ./src/allmydata/test/test_client.py 228 |
---|
93 | d.addCallback(_restart) |
---|
94 | return d |
---|
95 | |
---|
96 | -class NodeMaker(unittest.TestCase): |
---|
97 | +class NodeMaker(testutil.ReallyEqualMixin, unittest.TestCase): |
---|
98 | def test_maker(self): |
---|
99 | basedir = "client/NodeMaker/maker" |
---|
100 | fileutil.make_dirs(basedir) |
---|
101 | hunk ./src/allmydata/test/test_client.py 300 |
---|
102 | self.failIf(IMutableFileNode.providedBy(n)) |
---|
103 | self.failIf(IDirectoryNode.providedBy(n)) |
---|
104 | self.failUnless(n.is_unknown()) |
---|
105 | - self.failUnlessEqual(n.get_uri(), unknown_rw) |
---|
106 | - self.failUnlessEqual(n.get_write_uri(), unknown_rw) |
---|
107 | - self.failUnlessEqual(n.get_readonly_uri(), "ro." + unknown_ro) |
---|
108 | + self.failUnlessReallyEqual(n.get_uri(), unknown_rw) |
---|
109 | + self.failUnlessReallyEqual(n.get_write_uri(), unknown_rw) |
---|
110 | + self.failUnlessReallyEqual(n.get_readonly_uri(), "ro." + unknown_ro) |
---|
111 | + |
---|
112 | + unknown_rw = u"lafs://from_the_future_rw_\u263A".encode('utf-8') |
---|
113 | + unknown_ro = u"lafs://readonly_from_the_future_ro_\u263A".encode('utf-8') |
---|
114 | + n = c.create_node_from_uri(unknown_rw, unknown_ro) |
---|
115 | + self.failUnless(IFilesystemNode.providedBy(n)) |
---|
116 | + self.failIf(IFileNode.providedBy(n)) |
---|
117 | + self.failIf(IImmutableFileNode.providedBy(n)) |
---|
118 | + self.failIf(IMutableFileNode.providedBy(n)) |
---|
119 | + self.failIf(IDirectoryNode.providedBy(n)) |
---|
120 | + self.failUnless(n.is_unknown()) |
---|
121 | + self.failUnlessReallyEqual(n.get_uri(), unknown_rw) |
---|
122 | + self.failUnlessReallyEqual(n.get_write_uri(), unknown_rw) |
---|
123 | + self.failUnlessReallyEqual(n.get_readonly_uri(), "ro." + unknown_ro) |
---|
124 | hunk ./src/allmydata/test/test_dirnode.py 49 |
---|
125 | mut_read_uri = "URI:SSK-RO:jf6wkflosyvntwxqcdo7a54jvm:euw4iw7bbnkrrwpzuburbhppuxhc3gwxv26f6imekhz7zyw2ojnq" |
---|
126 | future_write_uri = "x-tahoe-crazy://I_am_from_the_future." |
---|
127 | future_read_uri = "x-tahoe-crazy-readonly://I_am_from_the_future." |
---|
128 | +future_nonascii_write_uri = u"x-tahoe-even-more-crazy://I_am_from_the_future_rw_\u263A".encode('utf-8') |
---|
129 | +future_nonascii_read_uri = u"x-tahoe-even-more-crazy-readonly://I_am_from_the_future_ro_\u263A".encode('utf-8') |
---|
130 | |
---|
131 | # 'o' 'n' 'e-macron' |
---|
132 | one_nfc = u"on\u0113" |
---|
133 | hunk ./src/allmydata/test/test_dirnode.py 57 |
---|
134 | one_nfd = u"one\u0304" |
---|
135 | |
---|
136 | class Dirnode(GridTestMixin, unittest.TestCase, |
---|
137 | - testutil.ShouldFailMixin, testutil.StallMixin, ErrorMixin): |
---|
138 | + testutil.ReallyEqualMixin, testutil.ShouldFailMixin, testutil.StallMixin, ErrorMixin): |
---|
139 | timeout = 240 # It takes longer than 120 seconds on Francois's arm box. |
---|
140 | |
---|
141 | def test_basic(self): |
---|
142 | hunk ./src/allmydata/test/test_dirnode.py 89 |
---|
143 | u"mut": (nm.create_from_cap(mut_write_uri, mut_read_uri), {}), |
---|
144 | u"fut": (nm.create_from_cap(future_write_uri, future_read_uri), {}), |
---|
145 | u"fro": (nm.create_from_cap(None, future_read_uri), {}), |
---|
146 | + u"fut-unic": (nm.create_from_cap(future_nonascii_write_uri, future_nonascii_read_uri), {}), |
---|
147 | + u"fro-unic": (nm.create_from_cap(None, future_nonascii_read_uri), {}), |
---|
148 | u"empty_litdir": (nm.create_from_cap(empty_litdir_uri), {}), |
---|
149 | u"tiny_litdir": (nm.create_from_cap(tiny_litdir_uri), {}), |
---|
150 | } |
---|
151 | hunk ./src/allmydata/test/test_dirnode.py 109 |
---|
152 | d.addCallback(_created) |
---|
153 | |
---|
154 | def _check_kids(children): |
---|
155 | - self.failUnlessEqual(set(children.keys()), |
---|
156 | - set([one_nfc, u"two", u"mut", u"fut", u"fro", u"empty_litdir", u"tiny_litdir"])) |
---|
157 | + self.failUnlessReallyEqual(set(children.keys()), |
---|
158 | + set([one_nfc, u"two", u"mut", u"fut", u"fro", |
---|
159 | + u"fut-unic", u"fro-unic", u"empty_litdir", u"tiny_litdir"])) |
---|
160 | one_node, one_metadata = children[one_nfc] |
---|
161 | two_node, two_metadata = children[u"two"] |
---|
162 | mut_node, mut_metadata = children[u"mut"] |
---|
163 | hunk ./src/allmydata/test/test_dirnode.py 117 |
---|
164 | fut_node, fut_metadata = children[u"fut"] |
---|
165 | fro_node, fro_metadata = children[u"fro"] |
---|
166 | + futna_node, futna_metadata = children[u"fut-unic"] |
---|
167 | + frona_node, frona_metadata = children[u"fro-unic"] |
---|
168 | emptylit_node, emptylit_metadata = children[u"empty_litdir"] |
---|
169 | tinylit_node, tinylit_metadata = children[u"tiny_litdir"] |
---|
170 | |
---|
171 | hunk ./src/allmydata/test/test_dirnode.py 122 |
---|
172 | - self.failUnlessEqual(one_node.get_size(), 3) |
---|
173 | - self.failUnlessEqual(one_node.get_uri(), one_uri) |
---|
174 | - self.failUnlessEqual(one_node.get_readonly_uri(), one_uri) |
---|
175 | + self.failUnlessReallyEqual(one_node.get_size(), 3) |
---|
176 | + self.failUnlessReallyEqual(one_node.get_uri(), one_uri) |
---|
177 | + self.failUnlessReallyEqual(one_node.get_readonly_uri(), one_uri) |
---|
178 | self.failUnless(isinstance(one_metadata, dict), one_metadata) |
---|
179 | |
---|
180 | hunk ./src/allmydata/test/test_dirnode.py 127 |
---|
181 | - self.failUnlessEqual(two_node.get_size(), 14861) |
---|
182 | - self.failUnlessEqual(two_node.get_uri(), setup_py_uri) |
---|
183 | - self.failUnlessEqual(two_node.get_readonly_uri(), setup_py_uri) |
---|
184 | - self.failUnlessEqual(two_metadata["metakey"], "metavalue") |
---|
185 | + self.failUnlessReallyEqual(two_node.get_size(), 14861) |
---|
186 | + self.failUnlessReallyEqual(two_node.get_uri(), setup_py_uri) |
---|
187 | + self.failUnlessReallyEqual(two_node.get_readonly_uri(), setup_py_uri) |
---|
188 | + self.failUnlessReallyEqual(two_metadata["metakey"], "metavalue") |
---|
189 | |
---|
190 | hunk ./src/allmydata/test/test_dirnode.py 132 |
---|
191 | - self.failUnlessEqual(mut_node.get_uri(), mut_write_uri) |
---|
192 | - self.failUnlessEqual(mut_node.get_readonly_uri(), mut_read_uri) |
---|
193 | + self.failUnlessReallyEqual(mut_node.get_uri(), mut_write_uri) |
---|
194 | + self.failUnlessReallyEqual(mut_node.get_readonly_uri(), mut_read_uri) |
---|
195 | self.failUnless(isinstance(mut_metadata, dict), mut_metadata) |
---|
196 | |
---|
197 | self.failUnless(fut_node.is_unknown()) |
---|
198 | hunk ./src/allmydata/test/test_dirnode.py 137 |
---|
199 | - self.failUnlessEqual(fut_node.get_uri(), future_write_uri) |
---|
200 | - self.failUnlessEqual(fut_node.get_readonly_uri(), "ro." + future_read_uri) |
---|
201 | + self.failUnlessReallyEqual(fut_node.get_uri(), future_write_uri) |
---|
202 | + self.failUnlessReallyEqual(fut_node.get_readonly_uri(), "ro." + future_read_uri) |
---|
203 | self.failUnless(isinstance(fut_metadata, dict), fut_metadata) |
---|
204 | hunk ./src/allmydata/test/test_dirnode.py 140 |
---|
205 | - |
---|
206 | + |
---|
207 | + self.failUnless(futna_node.is_unknown()) |
---|
208 | + self.failUnlessReallyEqual(futna_node.get_uri(), future_nonascii_write_uri) |
---|
209 | + self.failUnlessReallyEqual(futna_node.get_readonly_uri(), "ro." + future_nonascii_read_uri) |
---|
210 | + self.failUnless(isinstance(futna_metadata, dict), futna_metadata) |
---|
211 | + |
---|
212 | self.failUnless(fro_node.is_unknown()) |
---|
213 | hunk ./src/allmydata/test/test_dirnode.py 147 |
---|
214 | - self.failUnlessEqual(fro_node.get_uri(), "ro." + future_read_uri) |
---|
215 | - self.failUnlessEqual(fut_node.get_readonly_uri(), "ro." + future_read_uri) |
---|
216 | + self.failUnlessReallyEqual(fro_node.get_uri(), "ro." + future_read_uri) |
---|
217 | + self.failUnlessReallyEqual(fut_node.get_readonly_uri(), "ro." + future_read_uri) |
---|
218 | self.failUnless(isinstance(fro_metadata, dict), fro_metadata) |
---|
219 | |
---|
220 | hunk ./src/allmydata/test/test_dirnode.py 151 |
---|
221 | + self.failUnless(frona_node.is_unknown()) |
---|
222 | + self.failUnlessReallyEqual(frona_node.get_uri(), "ro." + future_nonascii_read_uri) |
---|
223 | + self.failUnlessReallyEqual(futna_node.get_readonly_uri(), "ro." + future_nonascii_read_uri) |
---|
224 | + self.failUnless(isinstance(frona_metadata, dict), frona_metadata) |
---|
225 | + |
---|
226 | self.failIf(emptylit_node.is_unknown()) |
---|
227 | hunk ./src/allmydata/test/test_dirnode.py 157 |
---|
228 | - self.failUnlessEqual(emptylit_node.get_storage_index(), None) |
---|
229 | + self.failUnlessReallyEqual(emptylit_node.get_storage_index(), None) |
---|
230 | self.failIf(tinylit_node.is_unknown()) |
---|
231 | hunk ./src/allmydata/test/test_dirnode.py 159 |
---|
232 | - self.failUnlessEqual(tinylit_node.get_storage_index(), None) |
---|
233 | + self.failUnlessReallyEqual(tinylit_node.get_storage_index(), None) |
---|
234 | |
---|
235 | d2 = defer.succeed(None) |
---|
236 | d2.addCallback(lambda ignored: emptylit_node.list()) |
---|
237 | hunk ./src/allmydata/test/test_dirnode.py 165 |
---|
238 | d2.addCallback(lambda children: self.failUnlessEqual(children, {})) |
---|
239 | d2.addCallback(lambda ignored: tinylit_node.list()) |
---|
240 | - d2.addCallback(lambda children: self.failUnlessEqual(set(children.keys()), |
---|
241 | - set([u"short"]))) |
---|
242 | + d2.addCallback(lambda children: self.failUnlessReallyEqual(set(children.keys()), |
---|
243 | + set([u"short"]))) |
---|
244 | d2.addCallback(lambda ignored: tinylit_node.list()) |
---|
245 | d2.addCallback(lambda children: children[u"short"][0].read(MemAccum())) |
---|
246 | hunk ./src/allmydata/test/test_dirnode.py 169 |
---|
247 | - d2.addCallback(lambda accum: self.failUnlessEqual(accum.data, "The end.")) |
---|
248 | + d2.addCallback(lambda accum: self.failUnlessReallyEqual(accum.data, "The end.")) |
---|
249 | return d2 |
---|
250 | |
---|
251 | d.addCallback(_check_kids) |
---|
252 | hunk ./src/allmydata/test/test_dirnode.py 205 |
---|
253 | u"two": (nm.create_from_cap(setup_py_uri), |
---|
254 | {"metakey": "metavalue"}), |
---|
255 | u"fut": (nm.create_from_cap(None, future_read_uri), {}), |
---|
256 | + u"futna": (nm.create_from_cap(None, future_nonascii_read_uri), {}), |
---|
257 | u"empty_litdir": (nm.create_from_cap(empty_litdir_uri), {}), |
---|
258 | u"tiny_litdir": (nm.create_from_cap(tiny_litdir_uri), {}), |
---|
259 | } |
---|
260 | hunk ./src/allmydata/test/test_dirnode.py 227 |
---|
261 | d.addCallback(_created) |
---|
262 | |
---|
263 | def _check_kids(children): |
---|
264 | - self.failUnlessEqual(set(children.keys()), |
---|
265 | - set([one_nfc, u"two", u"fut", u"empty_litdir", u"tiny_litdir"])) |
---|
266 | + self.failUnlessReallyEqual(set(children.keys()), |
---|
267 | + set([one_nfc, u"two", u"fut", u"futna", u"empty_litdir", u"tiny_litdir"])) |
---|
268 | one_node, one_metadata = children[one_nfc] |
---|
269 | two_node, two_metadata = children[u"two"] |
---|
270 | fut_node, fut_metadata = children[u"fut"] |
---|
271 | hunk ./src/allmydata/test/test_dirnode.py 232 |
---|
272 | + futna_node, futna_metadata = children[u"futna"] |
---|
273 | emptylit_node, emptylit_metadata = children[u"empty_litdir"] |
---|
274 | tinylit_node, tinylit_metadata = children[u"tiny_litdir"] |
---|
275 | |
---|
276 | hunk ./src/allmydata/test/test_dirnode.py 236 |
---|
277 | - self.failUnlessEqual(one_node.get_size(), 3) |
---|
278 | - self.failUnlessEqual(one_node.get_uri(), one_uri) |
---|
279 | - self.failUnlessEqual(one_node.get_readonly_uri(), one_uri) |
---|
280 | + self.failUnlessReallyEqual(one_node.get_size(), 3) |
---|
281 | + self.failUnlessReallyEqual(one_node.get_uri(), one_uri) |
---|
282 | + self.failUnlessReallyEqual(one_node.get_readonly_uri(), one_uri) |
---|
283 | self.failUnless(isinstance(one_metadata, dict), one_metadata) |
---|
284 | |
---|
285 | hunk ./src/allmydata/test/test_dirnode.py 241 |
---|
286 | - self.failUnlessEqual(two_node.get_size(), 14861) |
---|
287 | - self.failUnlessEqual(two_node.get_uri(), setup_py_uri) |
---|
288 | - self.failUnlessEqual(two_node.get_readonly_uri(), setup_py_uri) |
---|
289 | - self.failUnlessEqual(two_metadata["metakey"], "metavalue") |
---|
290 | + self.failUnlessReallyEqual(two_node.get_size(), 14861) |
---|
291 | + self.failUnlessReallyEqual(two_node.get_uri(), setup_py_uri) |
---|
292 | + self.failUnlessReallyEqual(two_node.get_readonly_uri(), setup_py_uri) |
---|
293 | + self.failUnlessReallyEqual(two_metadata["metakey"], "metavalue") |
---|
294 | |
---|
295 | self.failUnless(fut_node.is_unknown()) |
---|
296 | hunk ./src/allmydata/test/test_dirnode.py 247 |
---|
297 | - self.failUnlessEqual(fut_node.get_uri(), "imm." + future_read_uri) |
---|
298 | - self.failUnlessEqual(fut_node.get_readonly_uri(), "imm." + future_read_uri) |
---|
299 | + self.failUnlessReallyEqual(fut_node.get_uri(), "imm." + future_read_uri) |
---|
300 | + self.failUnlessReallyEqual(fut_node.get_readonly_uri(), "imm." + future_read_uri) |
---|
301 | self.failUnless(isinstance(fut_metadata, dict), fut_metadata) |
---|
302 | |
---|
303 | hunk ./src/allmydata/test/test_dirnode.py 251 |
---|
304 | + self.failUnless(futna_node.is_unknown()) |
---|
305 | + self.failUnlessReallyEqual(futna_node.get_uri(), "imm." + future_nonascii_read_uri) |
---|
306 | + self.failUnlessReallyEqual(futna_node.get_readonly_uri(), "imm." + future_nonascii_read_uri) |
---|
307 | + self.failUnless(isinstance(futna_metadata, dict), futna_metadata) |
---|
308 | + |
---|
309 | self.failIf(emptylit_node.is_unknown()) |
---|
310 | hunk ./src/allmydata/test/test_dirnode.py 257 |
---|
311 | - self.failUnlessEqual(emptylit_node.get_storage_index(), None) |
---|
312 | + self.failUnlessReallyEqual(emptylit_node.get_storage_index(), None) |
---|
313 | self.failIf(tinylit_node.is_unknown()) |
---|
314 | hunk ./src/allmydata/test/test_dirnode.py 259 |
---|
315 | - self.failUnlessEqual(tinylit_node.get_storage_index(), None) |
---|
316 | + self.failUnlessReallyEqual(tinylit_node.get_storage_index(), None) |
---|
317 | |
---|
318 | d2 = defer.succeed(None) |
---|
319 | d2.addCallback(lambda ignored: emptylit_node.list()) |
---|
320 | hunk ./src/allmydata/test/test_dirnode.py 265 |
---|
321 | d2.addCallback(lambda children: self.failUnlessEqual(children, {})) |
---|
322 | d2.addCallback(lambda ignored: tinylit_node.list()) |
---|
323 | - d2.addCallback(lambda children: self.failUnlessEqual(set(children.keys()), |
---|
324 | - set([u"short"]))) |
---|
325 | + d2.addCallback(lambda children: self.failUnlessReallyEqual(set(children.keys()), |
---|
326 | + set([u"short"]))) |
---|
327 | d2.addCallback(lambda ignored: tinylit_node.list()) |
---|
328 | d2.addCallback(lambda children: children[u"short"][0].read(MemAccum())) |
---|
329 | hunk ./src/allmydata/test/test_dirnode.py 269 |
---|
330 | - d2.addCallback(lambda accum: self.failUnlessEqual(accum.data, "The end.")) |
---|
331 | + d2.addCallback(lambda accum: self.failUnlessReallyEqual(accum.data, "The end.")) |
---|
332 | return d2 |
---|
333 | |
---|
334 | d.addCallback(_check_kids) |
---|
335 | hunk ./src/allmydata/test/test_dirnode.py 322 |
---|
336 | self.failUnless("RO-IMM" in rep) |
---|
337 | cap = dn.get_cap() |
---|
338 | self.failUnlessIn("LIT", cap.to_string()) |
---|
339 | - self.failUnlessEqual(cap.to_string(), "URI:DIR2-LIT:") |
---|
340 | + self.failUnlessReallyEqual(cap.to_string(), "URI:DIR2-LIT:") |
---|
341 | self.cap = cap |
---|
342 | return dn.list() |
---|
343 | d.addCallback(_created_empty) |
---|
344 | hunk ./src/allmydata/test/test_dirnode.py 340 |
---|
345 | self.failUnless("RO-IMM" in rep) |
---|
346 | cap = dn.get_cap() |
---|
347 | self.failUnlessIn("LIT", cap.to_string()) |
---|
348 | - self.failUnlessEqual(cap.to_string(), |
---|
349 | - "URI:DIR2-LIT:gi4tumj2n4wdcmz2kvjesosmjfkdu3rvpbtwwlbqhiwdeot3puwcy") |
---|
350 | + self.failUnlessReallyEqual(cap.to_string(), |
---|
351 | + "URI:DIR2-LIT:gi4tumj2n4wdcmz2kvjesosmjfkdu3rvpbtwwlbqhiwdeot3puwcy") |
---|
352 | self.cap = cap |
---|
353 | return dn.list() |
---|
354 | d.addCallback(_created_small) |
---|
355 | hunk ./src/allmydata/test/test_dirnode.py 345 |
---|
356 | - d.addCallback(lambda kids: self.failUnlessEqual(kids.keys(), [u"o"])) |
---|
357 | + d.addCallback(lambda kids: self.failUnlessReallyEqual(kids.keys(), [u"o"])) |
---|
358 | |
---|
359 | # now test n.create_subdirectory(mutable=False) |
---|
360 | d.addCallback(lambda ign: c.create_dirnode()) |
---|
361 | hunk ./src/allmydata/test/test_dirnode.py 355 |
---|
362 | d.addCallback(_check_kids) |
---|
363 | d.addCallback(lambda ign: n.list()) |
---|
364 | d.addCallback(lambda children: |
---|
365 | - self.failUnlessEqual(children.keys(), [u"subdir"])) |
---|
366 | + self.failUnlessReallyEqual(children.keys(), [u"subdir"])) |
---|
367 | d.addCallback(lambda ign: n.get(u"subdir")) |
---|
368 | d.addCallback(lambda sd: sd.list()) |
---|
369 | d.addCallback(_check_kids) |
---|
370 | hunk ./src/allmydata/test/test_dirnode.py 389 |
---|
371 | spacedout_read_uri = stripped_read_uri + " " |
---|
372 | |
---|
373 | child = nm.create_from_cap(spacedout_write_uri, spacedout_read_uri) |
---|
374 | - self.failUnlessEqual(child.get_write_uri(), spacedout_write_uri) |
---|
375 | - self.failUnlessEqual(child.get_readonly_uri(), "ro." + spacedout_read_uri) |
---|
376 | + self.failUnlessReallyEqual(child.get_write_uri(), spacedout_write_uri) |
---|
377 | + self.failUnlessReallyEqual(child.get_readonly_uri(), "ro." + spacedout_read_uri) |
---|
378 | |
---|
379 | child_dottedi = u"ch\u0131\u0307ld" |
---|
380 | |
---|
381 | hunk ./src/allmydata/test/test_dirnode.py 423 |
---|
382 | rw_uri = self.rootnode._decrypt_rwcapdata(rwcapdata) |
---|
383 | self.failUnlessIn(name, kids_out) |
---|
384 | (expected_child, ign) = kids_out[name] |
---|
385 | - self.failUnlessEqual(rw_uri, expected_child.get_write_uri()) |
---|
386 | - self.failUnlessEqual("ro." + ro_uri, expected_child.get_readonly_uri()) |
---|
387 | + self.failUnlessReallyEqual(rw_uri, expected_child.get_write_uri()) |
---|
388 | + self.failUnlessReallyEqual("ro." + ro_uri, expected_child.get_readonly_uri()) |
---|
389 | numkids += 1 |
---|
390 | |
---|
391 | hunk ./src/allmydata/test/test_dirnode.py 427 |
---|
392 | - self.failUnlessEqual(numkids, len(kids_out)) |
---|
393 | + self.failUnlessReallyEqual(numkids, len(kids_out)) |
---|
394 | return self.rootnode |
---|
395 | d.addCallback(_check_data) |
---|
396 | |
---|
397 | hunk ./src/allmydata/test/test_dirnode.py 456 |
---|
398 | # ro_uri, since it's unknown). Also the dotless-i + dot-above should have been |
---|
399 | # normalized to 'i'. |
---|
400 | |
---|
401 | - self.failUnlessEqual(set(children.keys()), set(kids_norm.keys())) |
---|
402 | + self.failUnlessReallyEqual(set(children.keys()), set(kids_norm.keys())) |
---|
403 | child_node, child_metadata = children[u"child"] |
---|
404 | |
---|
405 | hunk ./src/allmydata/test/test_dirnode.py 459 |
---|
406 | - self.failUnlessEqual(child_node.get_write_uri(), stripped_write_uri) |
---|
407 | - self.failUnlessEqual(child_node.get_readonly_uri(), "ro." + stripped_read_uri) |
---|
408 | + self.failUnlessReallyEqual(child_node.get_write_uri(), stripped_write_uri) |
---|
409 | + self.failUnlessReallyEqual(child_node.get_readonly_uri(), "ro." + stripped_read_uri) |
---|
410 | d.addCallback(_check_kids) |
---|
411 | |
---|
412 | d.addCallback(lambda ign: nm.create_from_cap(self.cap.to_string())) |
---|
413 | hunk ./src/allmydata/test/test_dirnode.py 516 |
---|
414 | def _check_results(r): |
---|
415 | self.failUnless(IDeepCheckResults.providedBy(r)) |
---|
416 | c = r.get_counters() |
---|
417 | - self.failUnlessEqual(c, |
---|
418 | - {"count-objects-checked": 4, |
---|
419 | - "count-objects-healthy": 4, |
---|
420 | - "count-objects-unhealthy": 0, |
---|
421 | - "count-objects-unrecoverable": 0, |
---|
422 | - "count-corrupt-shares": 0, |
---|
423 | - }) |
---|
424 | + self.failUnlessReallyEqual(c, |
---|
425 | + {"count-objects-checked": 4, |
---|
426 | + "count-objects-healthy": 4, |
---|
427 | + "count-objects-unhealthy": 0, |
---|
428 | + "count-objects-unrecoverable": 0, |
---|
429 | + "count-corrupt-shares": 0, |
---|
430 | + }) |
---|
431 | self.failIf(r.get_corrupt_shares()) |
---|
432 | hunk ./src/allmydata/test/test_dirnode.py 524 |
---|
433 | - self.failUnlessEqual(len(r.get_all_results()), 4) |
---|
434 | + self.failUnlessReallyEqual(len(r.get_all_results()), 4) |
---|
435 | d.addCallback(_check_results) |
---|
436 | return d |
---|
437 | |
---|
438 | hunk ./src/allmydata/test/test_dirnode.py 537 |
---|
439 | def _check_results(r): |
---|
440 | self.failUnless(IDeepCheckAndRepairResults.providedBy(r)) |
---|
441 | c = r.get_counters() |
---|
442 | - self.failUnlessEqual(c, |
---|
443 | - {"count-objects-checked": 4, |
---|
444 | - "count-objects-healthy-pre-repair": 4, |
---|
445 | - "count-objects-unhealthy-pre-repair": 0, |
---|
446 | - "count-objects-unrecoverable-pre-repair": 0, |
---|
447 | - "count-corrupt-shares-pre-repair": 0, |
---|
448 | - "count-objects-healthy-post-repair": 4, |
---|
449 | - "count-objects-unhealthy-post-repair": 0, |
---|
450 | - "count-objects-unrecoverable-post-repair": 0, |
---|
451 | - "count-corrupt-shares-post-repair": 0, |
---|
452 | - "count-repairs-attempted": 0, |
---|
453 | - "count-repairs-successful": 0, |
---|
454 | - "count-repairs-unsuccessful": 0, |
---|
455 | - }) |
---|
456 | + self.failUnlessReallyEqual(c, |
---|
457 | + {"count-objects-checked": 4, |
---|
458 | + "count-objects-healthy-pre-repair": 4, |
---|
459 | + "count-objects-unhealthy-pre-repair": 0, |
---|
460 | + "count-objects-unrecoverable-pre-repair": 0, |
---|
461 | + "count-corrupt-shares-pre-repair": 0, |
---|
462 | + "count-objects-healthy-post-repair": 4, |
---|
463 | + "count-objects-unhealthy-post-repair": 0, |
---|
464 | + "count-objects-unrecoverable-post-repair": 0, |
---|
465 | + "count-corrupt-shares-post-repair": 0, |
---|
466 | + "count-repairs-attempted": 0, |
---|
467 | + "count-repairs-successful": 0, |
---|
468 | + "count-repairs-unsuccessful": 0, |
---|
469 | + }) |
---|
470 | self.failIf(r.get_corrupt_shares()) |
---|
471 | self.failIf(r.get_remaining_corrupt_shares()) |
---|
472 | hunk ./src/allmydata/test/test_dirnode.py 553 |
---|
473 | - self.failUnlessEqual(len(r.get_all_results()), 4) |
---|
474 | + self.failUnlessReallyEqual(len(r.get_all_results()), 4) |
---|
475 | d.addCallback(_check_results) |
---|
476 | return d |
---|
477 | |
---|
478 | hunk ./src/allmydata/test/test_dirnode.py 569 |
---|
479 | d.addCallback(lambda rootnode: rootnode.start_deep_check().when_done()) |
---|
480 | def _check_results(r): |
---|
481 | c = r.get_counters() |
---|
482 | - self.failUnlessEqual(c, |
---|
483 | - {"count-objects-checked": 4, |
---|
484 | - "count-objects-healthy": 3, |
---|
485 | - "count-objects-unhealthy": 1, |
---|
486 | - "count-objects-unrecoverable": 0, |
---|
487 | - "count-corrupt-shares": 0, |
---|
488 | - }) |
---|
489 | - #self.failUnlessEqual(len(r.get_problems()), 1) # TODO |
---|
490 | + self.failUnlessReallyEqual(c, |
---|
491 | + {"count-objects-checked": 4, |
---|
492 | + "count-objects-healthy": 3, |
---|
493 | + "count-objects-unhealthy": 1, |
---|
494 | + "count-objects-unrecoverable": 0, |
---|
495 | + "count-corrupt-shares": 0, |
---|
496 | + }) |
---|
497 | + #self.failUnlessReallyEqual(len(r.get_problems()), 1) # TODO |
---|
498 | d.addCallback(_check_results) |
---|
499 | return d |
---|
500 | |
---|
501 | hunk ./src/allmydata/test/test_dirnode.py 658 |
---|
502 | u_v = n.get_verify_cap().to_string() |
---|
503 | self.failUnless(u_v.startswith("URI:DIR2-Verifier:"), u_v) |
---|
504 | u_r = n.get_repair_cap().to_string() |
---|
505 | - self.failUnlessEqual(u_r, u) |
---|
506 | + self.failUnlessReallyEqual(u_r, u) |
---|
507 | self.expected_manifest.append( ((), u) ) |
---|
508 | self.expected_verifycaps.add(u_v) |
---|
509 | si = n.get_storage_index() |
---|
510 | hunk ./src/allmydata/test/test_dirnode.py 664 |
---|
511 | self.expected_storage_indexes.add(base32.b2a(si)) |
---|
512 | expected_si = n._uri.get_storage_index() |
---|
513 | - self.failUnlessEqual(si, expected_si) |
---|
514 | + self.failUnlessReallyEqual(si, expected_si) |
---|
515 | |
---|
516 | d = n.list() |
---|
517 | d.addCallback(lambda res: self.failUnlessEqual(res, {})) |
---|
518 | hunk ./src/allmydata/test/test_dirnode.py 713 |
---|
519 | |
---|
520 | d.addCallback(lambda res: n.list()) |
---|
521 | d.addCallback(lambda children: |
---|
522 | - self.failUnlessEqual(set(children.keys()), |
---|
523 | - set([u"child", u"subdir"]))) |
---|
524 | + self.failUnlessReallyEqual(set(children.keys()), |
---|
525 | + set([u"child", u"subdir"]))) |
---|
526 | |
---|
527 | d.addCallback(lambda res: n.start_deep_stats().when_done()) |
---|
528 | def _check_deepstats(stats): |
---|
529 | hunk ./src/allmydata/test/test_dirnode.py 732 |
---|
530 | "largest-immutable-file": 0, |
---|
531 | } |
---|
532 | for k,v in expected.iteritems(): |
---|
533 | - self.failUnlessEqual(stats[k], v, |
---|
534 | - "stats[%s] was %s, not %s" % |
---|
535 | - (k, stats[k], v)) |
---|
536 | + self.failUnlessReallyEqual(stats[k], v, |
---|
537 | + "stats[%s] was %s, not %s" % |
---|
538 | + (k, stats[k], v)) |
---|
539 | self.failUnless(stats["size-directories"] > 500, |
---|
540 | stats["size-directories"]) |
---|
541 | self.failUnless(stats["largest-directory"] > 500, |
---|
542 | hunk ./src/allmydata/test/test_dirnode.py 739 |
---|
543 | stats["largest-directory"]) |
---|
544 | - self.failUnlessEqual(stats["size-files-histogram"], []) |
---|
545 | + self.failUnlessReallyEqual(stats["size-files-histogram"], []) |
---|
546 | d.addCallback(_check_deepstats) |
---|
547 | |
---|
548 | d.addCallback(lambda res: n.build_manifest().when_done()) |
---|
549 | hunk ./src/allmydata/test/test_dirnode.py 745 |
---|
550 | def _check_manifest(res): |
---|
551 | manifest = res["manifest"] |
---|
552 | - self.failUnlessEqual(sorted(manifest), |
---|
553 | - sorted(self.expected_manifest)) |
---|
554 | + self.failUnlessReallyEqual(sorted(manifest), |
---|
555 | + sorted(self.expected_manifest)) |
---|
556 | stats = res["stats"] |
---|
557 | _check_deepstats(stats) |
---|
558 | hunk ./src/allmydata/test/test_dirnode.py 749 |
---|
559 | - self.failUnlessEqual(self.expected_verifycaps, |
---|
560 | - res["verifycaps"]) |
---|
561 | - self.failUnlessEqual(self.expected_storage_indexes, |
---|
562 | - res["storage-index"]) |
---|
563 | + self.failUnlessReallyEqual(self.expected_verifycaps, |
---|
564 | + res["verifycaps"]) |
---|
565 | + self.failUnlessReallyEqual(self.expected_storage_indexes, |
---|
566 | + res["storage-index"]) |
---|
567 | d.addCallback(_check_manifest) |
---|
568 | |
---|
569 | def _add_subsubdir(res): |
---|
570 | hunk ./src/allmydata/test/test_dirnode.py 767 |
---|
571 | self.failUnless(isinstance(subsubdir, |
---|
572 | dirnode.DirectoryNode))) |
---|
573 | d.addCallback(lambda res: n.get_child_at_path(u"")) |
---|
574 | - d.addCallback(lambda res: self.failUnlessEqual(res.get_uri(), |
---|
575 | - n.get_uri())) |
---|
576 | + d.addCallback(lambda res: self.failUnlessReallyEqual(res.get_uri(), |
---|
577 | + n.get_uri())) |
---|
578 | |
---|
579 | d.addCallback(lambda res: n.get_metadata_for(u"child")) |
---|
580 | d.addCallback(lambda metadata: |
---|
581 | hunk ./src/allmydata/test/test_dirnode.py 772 |
---|
582 | - self.failUnlessEqual(set(metadata.keys()), |
---|
583 | - set(["tahoe"]))) |
---|
584 | + self.failUnlessReallyEqual(set(metadata.keys()), |
---|
585 | + set(["tahoe"]))) |
---|
586 | |
---|
587 | d.addCallback(lambda res: |
---|
588 | self.shouldFail(NoSuchChildError, "gcamap-no", |
---|
589 | hunk ./src/allmydata/test/test_dirnode.py 786 |
---|
590 | child, metadata = res |
---|
591 | self.failUnless(isinstance(child, dirnode.DirectoryNode)) |
---|
592 | # edge-metadata needs at least one path segment |
---|
593 | - self.failUnlessEqual(set(metadata.keys()), set([])) |
---|
594 | + self.failUnlessReallyEqual(set(metadata.keys()), set([])) |
---|
595 | d.addCallback(_check_child_and_metadata1) |
---|
596 | d.addCallback(lambda res: |
---|
597 | n.get_child_and_metadata_at_path(u"child")) |
---|
598 | hunk ./src/allmydata/test/test_dirnode.py 793 |
---|
599 | |
---|
600 | def _check_child_and_metadata2(res): |
---|
601 | child, metadata = res |
---|
602 | - self.failUnlessEqual(child.get_uri(), |
---|
603 | - fake_file_uri) |
---|
604 | - self.failUnlessEqual(set(metadata.keys()), set(["tahoe"])) |
---|
605 | + self.failUnlessReallyEqual(child.get_uri(), |
---|
606 | + fake_file_uri) |
---|
607 | + self.failUnlessReallyEqual(set(metadata.keys()), set(["tahoe"])) |
---|
608 | d.addCallback(_check_child_and_metadata2) |
---|
609 | |
---|
610 | d.addCallback(lambda res: |
---|
611 | hunk ./src/allmydata/test/test_dirnode.py 803 |
---|
612 | def _check_child_and_metadata3(res): |
---|
613 | child, metadata = res |
---|
614 | self.failUnless(isinstance(child, dirnode.DirectoryNode)) |
---|
615 | - self.failUnlessEqual(set(metadata.keys()), set(["tahoe"])) |
---|
616 | + self.failUnlessReallyEqual(set(metadata.keys()), set(["tahoe"])) |
---|
617 | d.addCallback(_check_child_and_metadata3) |
---|
618 | |
---|
619 | # set_uri + metadata |
---|
620 | hunk ./src/allmydata/test/test_dirnode.py 813 |
---|
621 | {})) |
---|
622 | d.addCallback(lambda res: n.get_metadata_for(u"c2")) |
---|
623 | d.addCallback(lambda metadata: |
---|
624 | - self.failUnlessEqual(set(metadata.keys()), set(["tahoe"]))) |
---|
625 | + self.failUnlessReallyEqual(set(metadata.keys()), set(["tahoe"]))) |
---|
626 | |
---|
627 | # You can't override the link timestamps. |
---|
628 | d.addCallback(lambda res: n.set_uri(u"c2", |
---|
629 | hunk ./src/allmydata/test/test_dirnode.py 831 |
---|
630 | fake_file_uri, fake_file_uri)) |
---|
631 | d.addCallback(lambda res: n.get_metadata_for(u"c3")) |
---|
632 | d.addCallback(lambda metadata: |
---|
633 | - self.failUnlessEqual(set(metadata.keys()), set(["tahoe"]))) |
---|
634 | + self.failUnlessReallyEqual(set(metadata.keys()), set(["tahoe"]))) |
---|
635 | |
---|
636 | # we can also add specific metadata at set_uri() time |
---|
637 | d.addCallback(lambda res: n.set_uri(u"c4", |
---|
638 | hunk ./src/allmydata/test/test_dirnode.py 857 |
---|
639 | overwrite=False)) |
---|
640 | d.addCallback(lambda res: n.get_metadata_for(u"d2")) |
---|
641 | d.addCallback(lambda metadata: |
---|
642 | - self.failUnlessEqual(set(metadata.keys()), set(["tahoe"]))) |
---|
643 | + self.failUnlessReallyEqual(set(metadata.keys()), set(["tahoe"]))) |
---|
644 | |
---|
645 | # if we don't set any defaults, the child should get timestamps |
---|
646 | d.addCallback(lambda res: n.set_node(u"d3", n)) |
---|
647 | hunk ./src/allmydata/test/test_dirnode.py 863 |
---|
648 | d.addCallback(lambda res: n.get_metadata_for(u"d3")) |
---|
649 | d.addCallback(lambda metadata: |
---|
650 | - self.failUnlessEqual(set(metadata.keys()), set(["tahoe"]))) |
---|
651 | + self.failUnlessReallyEqual(set(metadata.keys()), set(["tahoe"]))) |
---|
652 | |
---|
653 | # we can also add specific metadata at set_node() time |
---|
654 | d.addCallback(lambda res: n.set_node(u"d4", n, |
---|
655 | hunk ./src/allmydata/test/test_dirnode.py 901 |
---|
656 | d.addCallback(lambda children: self.failIf(u"new" in children)) |
---|
657 | d.addCallback(lambda res: n.get_metadata_for(u"e1")) |
---|
658 | d.addCallback(lambda metadata: |
---|
659 | - self.failUnlessEqual(set(metadata.keys()), set(["tahoe"]))) |
---|
660 | + self.failUnlessReallyEqual(set(metadata.keys()), set(["tahoe"]))) |
---|
661 | d.addCallback(lambda res: n.get_metadata_for(u"e2")) |
---|
662 | d.addCallback(lambda metadata: |
---|
663 | hunk ./src/allmydata/test/test_dirnode.py 904 |
---|
664 | - self.failUnlessEqual(set(metadata.keys()), set(["tahoe"]))) |
---|
665 | + self.failUnlessReallyEqual(set(metadata.keys()), set(["tahoe"]))) |
---|
666 | d.addCallback(lambda res: n.get_metadata_for(u"e3")) |
---|
667 | d.addCallback(lambda metadata: |
---|
668 | self.failUnless((set(metadata.keys()) == set(["key", "tahoe"])) and |
---|
669 | hunk ./src/allmydata/test/test_dirnode.py 932 |
---|
670 | d.addCallback(lambda children: self.failIf(u"new" in children)) |
---|
671 | d.addCallback(lambda res: n.get_metadata_for(u"f1")) |
---|
672 | d.addCallback(lambda metadata: |
---|
673 | - self.failUnlessEqual(set(metadata.keys()), set(["tahoe"]))) |
---|
674 | + self.failUnlessReallyEqual(set(metadata.keys()), set(["tahoe"]))) |
---|
675 | d.addCallback(lambda res: n.get_metadata_for(u"f2")) |
---|
676 | d.addCallback(lambda metadata: |
---|
677 | hunk ./src/allmydata/test/test_dirnode.py 935 |
---|
678 | - self.failUnlessEqual(set(metadata.keys()), set(["tahoe"]))) |
---|
679 | + self.failUnlessReallyEqual(set(metadata.keys()), set(["tahoe"]))) |
---|
680 | d.addCallback(lambda res: n.get_metadata_for(u"f3")) |
---|
681 | d.addCallback(lambda metadata: |
---|
682 | self.failUnless((set(metadata.keys()) == set(["key", "tahoe"])) and |
---|
683 | hunk ./src/allmydata/test/test_dirnode.py 978 |
---|
684 | |
---|
685 | d.addCallback(lambda res: n.get_metadata_for(u"timestamps")) |
---|
686 | def _check_timestamp1(metadata): |
---|
687 | - self.failUnlessEqual(set(metadata.keys()), set(["tahoe"])) |
---|
688 | + self.failUnlessReallyEqual(set(metadata.keys()), set(["tahoe"])) |
---|
689 | tahoe_md = metadata["tahoe"] |
---|
690 | hunk ./src/allmydata/test/test_dirnode.py 980 |
---|
691 | - self.failUnlessEqual(set(tahoe_md.keys()), set(["linkcrtime", "linkmotime"])) |
---|
692 | + self.failUnlessReallyEqual(set(tahoe_md.keys()), set(["linkcrtime", "linkmotime"])) |
---|
693 | |
---|
694 | self.failUnlessGreaterOrEqualThan(tahoe_md["linkcrtime"], |
---|
695 | self._start_timestamp) |
---|
696 | hunk ./src/allmydata/test/test_dirnode.py 1002 |
---|
697 | def _check_timestamp2(metadata): |
---|
698 | self.failUnlessIn("tahoe", metadata) |
---|
699 | tahoe_md = metadata["tahoe"] |
---|
700 | - self.failUnlessEqual(set(tahoe_md.keys()), set(["linkcrtime", "linkmotime"])) |
---|
701 | + self.failUnlessReallyEqual(set(tahoe_md.keys()), set(["linkcrtime", "linkmotime"])) |
---|
702 | |
---|
703 | hunk ./src/allmydata/test/test_dirnode.py 1004 |
---|
704 | - self.failUnlessEqual(tahoe_md["linkcrtime"], self._old_linkcrtime) |
---|
705 | + self.failUnlessReallyEqual(tahoe_md["linkcrtime"], self._old_linkcrtime) |
---|
706 | self.failUnlessGreaterThan(tahoe_md["linkmotime"], self._old_linkmotime) |
---|
707 | return n.delete(u"timestamps") |
---|
708 | d.addCallback(_check_timestamp2) |
---|
709 | hunk ./src/allmydata/test/test_dirnode.py 1011 |
---|
710 | |
---|
711 | d.addCallback(lambda res: n.delete(u"subdir")) |
---|
712 | d.addCallback(lambda old_child: |
---|
713 | - self.failUnlessEqual(old_child.get_uri(), |
---|
714 | + self.failUnlessReallyEqual(old_child.get_uri(), |
---|
715 | self.subdir.get_uri())) |
---|
716 | |
---|
717 | d.addCallback(lambda res: n.list()) |
---|
718 | hunk ./src/allmydata/test/test_dirnode.py 1016 |
---|
719 | d.addCallback(lambda children: |
---|
720 | - self.failUnlessEqual(set(children.keys()), |
---|
721 | - set([u"child"]))) |
---|
722 | + self.failUnlessReallyEqual(set(children.keys()), |
---|
723 | + set([u"child"]))) |
---|
724 | |
---|
725 | uploadable1 = upload.Data("some data", convergence="converge") |
---|
726 | d.addCallback(lambda res: n.add_file(u"newfile", uploadable1)) |
---|
727 | hunk ./src/allmydata/test/test_dirnode.py 1032 |
---|
728 | overwrite=False)) |
---|
729 | d.addCallback(lambda res: n.list()) |
---|
730 | d.addCallback(lambda children: |
---|
731 | - self.failUnlessEqual(set(children.keys()), |
---|
732 | - set([u"child", u"newfile"]))) |
---|
733 | + self.failUnlessReallyEqual(set(children.keys()), |
---|
734 | + set([u"child", u"newfile"]))) |
---|
735 | d.addCallback(lambda res: n.get_metadata_for(u"newfile")) |
---|
736 | d.addCallback(lambda metadata: |
---|
737 | hunk ./src/allmydata/test/test_dirnode.py 1036 |
---|
738 | - self.failUnlessEqual(set(metadata.keys()), set(["tahoe"]))) |
---|
739 | + self.failUnlessReallyEqual(set(metadata.keys()), set(["tahoe"]))) |
---|
740 | |
---|
741 | uploadable3 = upload.Data("some data", convergence="converge") |
---|
742 | d.addCallback(lambda res: n.add_file(u"newfile-metadata", |
---|
743 | hunk ./src/allmydata/test/test_dirnode.py 1062 |
---|
744 | n.move_child_to(u"child", self.subdir2)) |
---|
745 | d.addCallback(lambda res: n.list()) |
---|
746 | d.addCallback(lambda children: |
---|
747 | - self.failUnlessEqual(set(children.keys()), |
---|
748 | - set([u"newfile", u"subdir2"]))) |
---|
749 | + self.failUnlessReallyEqual(set(children.keys()), |
---|
750 | + set([u"newfile", u"subdir2"]))) |
---|
751 | d.addCallback(lambda res: self.subdir2.list()) |
---|
752 | d.addCallback(lambda children: |
---|
753 | hunk ./src/allmydata/test/test_dirnode.py 1066 |
---|
754 | - self.failUnlessEqual(set(children.keys()), |
---|
755 | - set([u"child"]))) |
---|
756 | + self.failUnlessReallyEqual(set(children.keys()), |
---|
757 | + set([u"child"]))) |
---|
758 | d.addCallback(lambda res: self.subdir2.get(u"child")) |
---|
759 | d.addCallback(lambda child: |
---|
760 | hunk ./src/allmydata/test/test_dirnode.py 1070 |
---|
761 | - self.failUnlessEqual(child.get_uri(), |
---|
762 | - fake_file_uri)) |
---|
763 | + self.failUnlessReallyEqual(child.get_uri(), |
---|
764 | + fake_file_uri)) |
---|
765 | |
---|
766 | # move it back, using new_child_name= |
---|
767 | d.addCallback(lambda res: |
---|
768 | hunk ./src/allmydata/test/test_dirnode.py 1078 |
---|
769 | self.subdir2.move_child_to(u"child", n, u"newchild")) |
---|
770 | d.addCallback(lambda res: n.list()) |
---|
771 | d.addCallback(lambda children: |
---|
772 | - self.failUnlessEqual(set(children.keys()), |
---|
773 | - set([u"newchild", u"newfile", |
---|
774 | - u"subdir2"]))) |
---|
775 | + self.failUnlessReallyEqual(set(children.keys()), |
---|
776 | + set([u"newchild", u"newfile", |
---|
777 | + u"subdir2"]))) |
---|
778 | d.addCallback(lambda res: self.subdir2.list()) |
---|
779 | d.addCallback(lambda children: |
---|
780 | hunk ./src/allmydata/test/test_dirnode.py 1083 |
---|
781 | - self.failUnlessEqual(set(children.keys()), set([]))) |
---|
782 | + self.failUnlessReallyEqual(set(children.keys()), set([]))) |
---|
783 | |
---|
784 | # now make sure that we honor overwrite=False |
---|
785 | d.addCallback(lambda res: |
---|
786 | hunk ./src/allmydata/test/test_dirnode.py 1098 |
---|
787 | overwrite=False)) |
---|
788 | d.addCallback(lambda res: self.subdir2.get(u"newchild")) |
---|
789 | d.addCallback(lambda child: |
---|
790 | - self.failUnlessEqual(child.get_uri(), |
---|
791 | - other_file_uri)) |
---|
792 | + self.failUnlessReallyEqual(child.get_uri(), |
---|
793 | + other_file_uri)) |
---|
794 | |
---|
795 | |
---|
796 | # Setting the no-write field should diminish a mutable cap to read-only |
---|
797 | hunk ./src/allmydata/test/test_dirnode.py 1141 |
---|
798 | (t1, t2, t3) = (626644800.0, 634745640.0, 892226160.0) |
---|
799 | |
---|
800 | md1 = dirnode.update_metadata({"ctime": t1}, {}, t2) |
---|
801 | - self.failUnlessEqual(md1, {"tahoe":{"linkcrtime": t1, "linkmotime": t2}}) |
---|
802 | + self.failUnlessReallyEqual(md1, {"tahoe":{"linkcrtime": t1, "linkmotime": t2}}) |
---|
803 | |
---|
804 | md2 = dirnode.update_metadata(md1, {"key": "value", "tahoe": {"bad": "mojo"}}, t3) |
---|
805 | hunk ./src/allmydata/test/test_dirnode.py 1144 |
---|
806 | - self.failUnlessEqual(md2, {"key": "value", |
---|
807 | - "tahoe":{"linkcrtime": t1, "linkmotime": t3}}) |
---|
808 | + self.failUnlessReallyEqual(md2, {"key": "value", |
---|
809 | + "tahoe":{"linkcrtime": t1, "linkmotime": t3}}) |
---|
810 | |
---|
811 | md3 = dirnode.update_metadata({}, None, t3) |
---|
812 | hunk ./src/allmydata/test/test_dirnode.py 1148 |
---|
813 | - self.failUnlessEqual(md3, {"tahoe":{"linkcrtime": t3, "linkmotime": t3}}) |
---|
814 | + self.failUnlessReallyEqual(md3, {"tahoe":{"linkcrtime": t3, "linkmotime": t3}}) |
---|
815 | |
---|
816 | md4 = dirnode.update_metadata({}, {"bool": True, "number": 42}, t1) |
---|
817 | hunk ./src/allmydata/test/test_dirnode.py 1151 |
---|
818 | - self.failUnlessEqual(md4, {"bool": True, "number": 42, |
---|
819 | - "tahoe":{"linkcrtime": t1, "linkmotime": t1}}) |
---|
820 | + self.failUnlessReallyEqual(md4, {"bool": True, "number": 42, |
---|
821 | + "tahoe":{"linkcrtime": t1, "linkmotime": t1}}) |
---|
822 | |
---|
823 | def test_create_subdirectory(self): |
---|
824 | self.basedir = "dirnode/Dirnode/test_create_subdirectory" |
---|
825 | hunk ./src/allmydata/test/test_dirnode.py 1173 |
---|
826 | d = n.create_subdirectory(u"subdir", kids) |
---|
827 | def _check(sub): |
---|
828 | d = n.get_child_at_path(u"subdir") |
---|
829 | - d.addCallback(lambda sub2: self.failUnlessEqual(sub2.get_uri(), |
---|
830 | - sub.get_uri())) |
---|
831 | + d.addCallback(lambda sub2: self.failUnlessReallyEqual(sub2.get_uri(), |
---|
832 | + sub.get_uri())) |
---|
833 | d.addCallback(lambda ign: sub.list()) |
---|
834 | return d |
---|
835 | d.addCallback(_check) |
---|
836 | hunk ./src/allmydata/test/test_dirnode.py 1179 |
---|
837 | def _check_kids(kids2): |
---|
838 | - self.failUnlessEqual(set(kids.keys()), set(kids2.keys())) |
---|
839 | - self.failUnlessEqual(kids2[u"kid2"][1]["metakey"], "metavalue") |
---|
840 | + self.failUnlessReallyEqual(set(kids.keys()), set(kids2.keys())) |
---|
841 | + self.failUnlessReallyEqual(kids2[u"kid2"][1]["metakey"], "metavalue") |
---|
842 | d.addCallback(_check_kids) |
---|
843 | return d |
---|
844 | d.addCallback(_then) |
---|
845 | hunk ./src/allmydata/test/test_dirnode.py 1190 |
---|
846 | def get_writekey(self): |
---|
847 | return "writekey" |
---|
848 | |
---|
849 | -class Packing(unittest.TestCase): |
---|
850 | +class Packing(testutil.ReallyEqualMixin, unittest.TestCase): |
---|
851 | # This is a base32-encoded representation of the directory tree |
---|
852 | # root/file1 |
---|
853 | # root/file2 |
---|
854 | hunk ./src/allmydata/test/test_dirnode.py 1227 |
---|
855 | file3_rocap = "URI:CHK:cmtcxq7hwxvfxan34yiev6ivhy:qvcekmjtoetdcw4kmi7b3rtblvgx7544crnwaqtiewemdliqsokq:3:10:5" |
---|
856 | file3_rwcap = "URI:CHK:cmtcxq7hwxvfxan34yiev6ivhy:qvcekmjtoetdcw4kmi7b3rtblvgx7544crnwaqtiewemdliqsokq:3:10:5" |
---|
857 | file3_metadata = {'ctime': 1246663897.4336269, 'tahoe': {'linkmotime': 1246663897.4336269, 'linkcrtime': 1246663897.4336269}, 'mtime': 1246663897.4336269} |
---|
858 | - self.failUnlessEqual(file3_metadata, children[u'file3'][1]) |
---|
859 | - self.failUnlessEqual(file3_rocap, |
---|
860 | - children[u'file3'][0].get_readonly_uri()) |
---|
861 | - self.failUnlessEqual(file3_rwcap, |
---|
862 | - children[u'file3'][0].get_uri()) |
---|
863 | + self.failUnlessReallyEqual(file3_metadata, children[u'file3'][1]) |
---|
864 | + self.failUnlessReallyEqual(file3_rocap, |
---|
865 | + children[u'file3'][0].get_readonly_uri()) |
---|
866 | + self.failUnlessReallyEqual(file3_rwcap, |
---|
867 | + children[u'file3'][0].get_uri()) |
---|
868 | |
---|
869 | # Are the metadata for child 2 right? |
---|
870 | file2_rocap = "URI:CHK:apegrpehshwugkbh3jlt5ei6hq:5oougnemcl5xgx4ijgiumtdojlipibctjkbwvyygdymdphib2fvq:3:10:4" |
---|
871 | hunk ./src/allmydata/test/test_dirnode.py 1237 |
---|
872 | file2_rwcap = "URI:CHK:apegrpehshwugkbh3jlt5ei6hq:5oougnemcl5xgx4ijgiumtdojlipibctjkbwvyygdymdphib2fvq:3:10:4" |
---|
873 | file2_metadata = {'ctime': 1246663897.430218, 'tahoe': {'linkmotime': 1246663897.430218, 'linkcrtime': 1246663897.430218}, 'mtime': 1246663897.430218} |
---|
874 | - self.failUnlessEqual(file2_metadata, children[u'file2'][1]) |
---|
875 | - self.failUnlessEqual(file2_rocap, |
---|
876 | + self.failUnlessReallyEqual(file2_metadata, children[u'file2'][1]) |
---|
877 | + self.failUnlessReallyEqual(file2_rocap, |
---|
878 | children[u'file2'][0].get_readonly_uri()) |
---|
879 | hunk ./src/allmydata/test/test_dirnode.py 1240 |
---|
880 | - self.failUnlessEqual(file2_rwcap, |
---|
881 | + self.failUnlessReallyEqual(file2_rwcap, |
---|
882 | children[u'file2'][0].get_uri()) |
---|
883 | |
---|
884 | # Are the metadata for child 1 right? |
---|
885 | hunk ./src/allmydata/test/test_dirnode.py 1247 |
---|
886 | file1_rocap = "URI:CHK:olxtimympo7f27jvhtgqlnbtn4:emzdnhk2um4seixozlkw3qx2nfijvdkx3ky7i7izl47yedl6e64a:3:10:10" |
---|
887 | file1_rwcap = "URI:CHK:olxtimympo7f27jvhtgqlnbtn4:emzdnhk2um4seixozlkw3qx2nfijvdkx3ky7i7izl47yedl6e64a:3:10:10" |
---|
888 | file1_metadata = {'ctime': 1246663897.4275661, 'tahoe': {'linkmotime': 1246663897.4275661, 'linkcrtime': 1246663897.4275661}, 'mtime': 1246663897.4275661} |
---|
889 | - self.failUnlessEqual(file1_metadata, children[u'file1'][1]) |
---|
890 | - self.failUnlessEqual(file1_rocap, |
---|
891 | + self.failUnlessReallyEqual(file1_metadata, children[u'file1'][1]) |
---|
892 | + self.failUnlessReallyEqual(file1_rocap, |
---|
893 | children[u'file1'][0].get_readonly_uri()) |
---|
894 | hunk ./src/allmydata/test/test_dirnode.py 1250 |
---|
895 | - self.failUnlessEqual(file1_rwcap, |
---|
896 | + self.failUnlessReallyEqual(file1_rwcap, |
---|
897 | children[u'file1'][0].get_uri()) |
---|
898 | |
---|
899 | def _make_kids(self, nm, which): |
---|
900 | hunk ./src/allmydata/test/test_dirnode.py 1367 |
---|
901 | def create_node_from_uri(self, rwcap, rocap): |
---|
902 | return self.nodemaker.create_from_cap(rwcap, rocap) |
---|
903 | |
---|
904 | -class Dirnode2(unittest.TestCase, testutil.ShouldFailMixin): |
---|
905 | +class Dirnode2(testutil.ReallyEqualMixin, testutil.ShouldFailMixin, unittest.TestCase): |
---|
906 | def setUp(self): |
---|
907 | client = FakeClient2() |
---|
908 | self.nodemaker = client.nodemaker |
---|
909 | hunk ./src/allmydata/test/test_dirnode.py 1376 |
---|
910 | # Create a mutable directory that contains unknown URI types, and make sure |
---|
911 | # we tolerate them properly. |
---|
912 | d = self.nodemaker.create_new_mutable_directory() |
---|
913 | - future_write_uri = "x-tahoe-crazy://I_am_from_the_future." |
---|
914 | - future_read_uri = "x-tahoe-crazy-readonly://I_am_from_the_future." |
---|
915 | - future_imm_uri = "x-tahoe-crazy-immutable://I_am_from_the_future." |
---|
916 | + future_write_uri = u"x-tahoe-crazy://I_am_from_the_future_rw_\u263A".encode('utf-8') |
---|
917 | + future_read_uri = u"x-tahoe-crazy-readonly://I_am_from_the_future_ro_\u263A".encode('utf-8') |
---|
918 | + future_imm_uri = u"x-tahoe-crazy-immutable://I_am_from_the_future_imm_\u263A".encode('utf-8') |
---|
919 | future_node = UnknownNode(future_write_uri, future_read_uri) |
---|
920 | def _then(n): |
---|
921 | self._node = n |
---|
922 | hunk ./src/allmydata/test/test_dirnode.py 1409 |
---|
923 | |
---|
924 | d.addCallback(lambda ign: self._node.list()) |
---|
925 | def _check(children): |
---|
926 | - self.failUnlessEqual(len(children), 4) |
---|
927 | + self.failUnlessReallyEqual(len(children), 4) |
---|
928 | (fn, metadata) = children[u"future"] |
---|
929 | self.failUnless(isinstance(fn, UnknownNode), fn) |
---|
930 | hunk ./src/allmydata/test/test_dirnode.py 1412 |
---|
931 | - self.failUnlessEqual(fn.get_uri(), future_write_uri) |
---|
932 | - self.failUnlessEqual(fn.get_write_uri(), future_write_uri) |
---|
933 | - self.failUnlessEqual(fn.get_readonly_uri(), "ro." + future_read_uri) |
---|
934 | + self.failUnlessReallyEqual(fn.get_uri(), future_write_uri) |
---|
935 | + self.failUnlessReallyEqual(fn.get_write_uri(), future_write_uri) |
---|
936 | + self.failUnlessReallyEqual(fn.get_readonly_uri(), "ro." + future_read_uri) |
---|
937 | |
---|
938 | (fn2, metadata2) = children[u"add-pair"] |
---|
939 | self.failUnless(isinstance(fn2, UnknownNode), fn2) |
---|
940 | hunk ./src/allmydata/test/test_dirnode.py 1418 |
---|
941 | - self.failUnlessEqual(fn2.get_uri(), future_write_uri) |
---|
942 | - self.failUnlessEqual(fn2.get_write_uri(), future_write_uri) |
---|
943 | - self.failUnlessEqual(fn2.get_readonly_uri(), "ro." + future_read_uri) |
---|
944 | + self.failUnlessReallyEqual(fn2.get_uri(), future_write_uri) |
---|
945 | + self.failUnlessReallyEqual(fn2.get_write_uri(), future_write_uri) |
---|
946 | + self.failUnlessReallyEqual(fn2.get_readonly_uri(), "ro." + future_read_uri) |
---|
947 | |
---|
948 | (fn3, metadata3) = children[u"add-ro"] |
---|
949 | self.failUnless(isinstance(fn3, UnknownNode), fn3) |
---|
950 | hunk ./src/allmydata/test/test_dirnode.py 1424 |
---|
951 | - self.failUnlessEqual(fn3.get_uri(), "ro." + future_read_uri) |
---|
952 | - self.failUnlessEqual(fn3.get_write_uri(), None) |
---|
953 | - self.failUnlessEqual(fn3.get_readonly_uri(), "ro." + future_read_uri) |
---|
954 | + self.failUnlessReallyEqual(fn3.get_uri(), "ro." + future_read_uri) |
---|
955 | + self.failUnlessReallyEqual(fn3.get_write_uri(), None) |
---|
956 | + self.failUnlessReallyEqual(fn3.get_readonly_uri(), "ro." + future_read_uri) |
---|
957 | |
---|
958 | (fn4, metadata4) = children[u"add-imm"] |
---|
959 | self.failUnless(isinstance(fn4, UnknownNode), fn4) |
---|
960 | hunk ./src/allmydata/test/test_dirnode.py 1430 |
---|
961 | - self.failUnlessEqual(fn4.get_uri(), "imm." + future_imm_uri) |
---|
962 | - self.failUnlessEqual(fn4.get_write_uri(), None) |
---|
963 | - self.failUnlessEqual(fn4.get_readonly_uri(), "imm." + future_imm_uri) |
---|
964 | + self.failUnlessReallyEqual(fn4.get_uri(), "imm." + future_imm_uri) |
---|
965 | + self.failUnlessReallyEqual(fn4.get_write_uri(), None) |
---|
966 | + self.failUnlessReallyEqual(fn4.get_readonly_uri(), "imm." + future_imm_uri) |
---|
967 | |
---|
968 | # We should also be allowed to copy the "future" UnknownNode, because |
---|
969 | # it contains all the information that was in the original directory |
---|
970 | hunk ./src/allmydata/test/test_dirnode.py 1442 |
---|
971 | |
---|
972 | d.addCallback(lambda ign: self._node.list()) |
---|
973 | def _check2(children): |
---|
974 | - self.failUnlessEqual(len(children), 5) |
---|
975 | + self.failUnlessReallyEqual(len(children), 5) |
---|
976 | (fn, metadata) = children[u"copy"] |
---|
977 | self.failUnless(isinstance(fn, UnknownNode), fn) |
---|
978 | hunk ./src/allmydata/test/test_dirnode.py 1445 |
---|
979 | - self.failUnlessEqual(fn.get_uri(), future_write_uri) |
---|
980 | - self.failUnlessEqual(fn.get_write_uri(), future_write_uri) |
---|
981 | - self.failUnlessEqual(fn.get_readonly_uri(), "ro." + future_read_uri) |
---|
982 | + self.failUnlessReallyEqual(fn.get_uri(), future_write_uri) |
---|
983 | + self.failUnlessReallyEqual(fn.get_write_uri(), future_write_uri) |
---|
984 | + self.failUnlessReallyEqual(fn.get_readonly_uri(), "ro." + future_read_uri) |
---|
985 | d.addCallback(_check2) |
---|
986 | return d |
---|
987 | |
---|
988 | hunk ./src/allmydata/test/test_dirnode.py 1452 |
---|
989 | def test_unknown_strip_prefix_for_ro(self): |
---|
990 | - self.failUnlessEqual(strip_prefix_for_ro("foo", False), "foo") |
---|
991 | - self.failUnlessEqual(strip_prefix_for_ro("ro.foo", False), "foo") |
---|
992 | - self.failUnlessEqual(strip_prefix_for_ro("imm.foo", False), "imm.foo") |
---|
993 | - self.failUnlessEqual(strip_prefix_for_ro("foo", True), "foo") |
---|
994 | - self.failUnlessEqual(strip_prefix_for_ro("ro.foo", True), "foo") |
---|
995 | - self.failUnlessEqual(strip_prefix_for_ro("imm.foo", True), "foo") |
---|
996 | + self.failUnlessReallyEqual(strip_prefix_for_ro("foo", False), "foo") |
---|
997 | + self.failUnlessReallyEqual(strip_prefix_for_ro("ro.foo", False), "foo") |
---|
998 | + self.failUnlessReallyEqual(strip_prefix_for_ro("imm.foo", False), "imm.foo") |
---|
999 | + self.failUnlessReallyEqual(strip_prefix_for_ro("foo", True), "foo") |
---|
1000 | + self.failUnlessReallyEqual(strip_prefix_for_ro("ro.foo", True), "foo") |
---|
1001 | + self.failUnlessReallyEqual(strip_prefix_for_ro("imm.foo", True), "foo") |
---|
1002 | |
---|
1003 | def test_unknownnode(self): |
---|
1004 | mut_write_uri = "URI:SSK:vfvcbdfbszyrsaxchgevhmmlii:euw4iw7bbnkrrwpzuburbhppuxhc3gwxv26f6imekhz7zyw2ojnq" |
---|
1005 | hunk ./src/allmydata/test/test_dirnode.py 1555 |
---|
1006 | self.failUnless(n.get_readonly_uri().startswith("imm."), i) |
---|
1007 | |
---|
1008 | |
---|
1009 | -class DeepStats(unittest.TestCase): |
---|
1010 | +class DeepStats(testutil.ReallyEqualMixin, unittest.TestCase): |
---|
1011 | timeout = 240 # It takes longer than 120 seconds on Francois's arm box. |
---|
1012 | def test_stats(self): |
---|
1013 | ds = dirnode.DeepStats(None) |
---|
1014 | hunk ./src/allmydata/test/test_dirnode.py 1565 |
---|
1015 | ds.max("largest-directory", 444) |
---|
1016 | |
---|
1017 | s = ds.get_results() |
---|
1018 | - self.failUnlessEqual(s["count-files"], 1) |
---|
1019 | - self.failUnlessEqual(s["size-immutable-files"], 123) |
---|
1020 | - self.failUnlessEqual(s["largest-directory"], 444) |
---|
1021 | - self.failUnlessEqual(s["count-literal-files"], 0) |
---|
1022 | + self.failUnlessReallyEqual(s["count-files"], 1) |
---|
1023 | + self.failUnlessReallyEqual(s["size-immutable-files"], 123) |
---|
1024 | + self.failUnlessReallyEqual(s["largest-directory"], 444) |
---|
1025 | + self.failUnlessReallyEqual(s["count-literal-files"], 0) |
---|
1026 | |
---|
1027 | ds.add("count-files") |
---|
1028 | ds.add("size-immutable-files", 321) |
---|
1029 | hunk ./src/allmydata/test/test_dirnode.py 1576 |
---|
1030 | ds.max("largest-directory", 2) |
---|
1031 | |
---|
1032 | s = ds.get_results() |
---|
1033 | - self.failUnlessEqual(s["count-files"], 2) |
---|
1034 | - self.failUnlessEqual(s["size-immutable-files"], 444) |
---|
1035 | - self.failUnlessEqual(s["largest-directory"], 444) |
---|
1036 | - self.failUnlessEqual(s["count-literal-files"], 0) |
---|
1037 | - self.failUnlessEqual(s["size-files-histogram"], |
---|
1038 | + self.failUnlessReallyEqual(s["count-files"], 2) |
---|
1039 | + self.failUnlessReallyEqual(s["size-immutable-files"], 444) |
---|
1040 | + self.failUnlessReallyEqual(s["largest-directory"], 444) |
---|
1041 | + self.failUnlessReallyEqual(s["count-literal-files"], 0) |
---|
1042 | + self.failUnlessReallyEqual(s["size-files-histogram"], |
---|
1043 | [ (101, 316, 1), (317, 1000, 1) ]) |
---|
1044 | |
---|
1045 | ds = dirnode.DeepStats(None) |
---|
1046 | hunk ./src/allmydata/test/test_dirnode.py 1588 |
---|
1047 | ds.histogram("size-files-histogram", i) |
---|
1048 | ds.histogram("size-files-histogram", 4*1000*1000*1000*1000) # 4TB |
---|
1049 | s = ds.get_results() |
---|
1050 | - self.failUnlessEqual(s["size-files-histogram"], |
---|
1051 | + self.failUnlessReallyEqual(s["size-files-histogram"], |
---|
1052 | [ (1, 3, 3), |
---|
1053 | (4, 10, 7), |
---|
1054 | (11, 31, 21), |
---|
1055 | hunk ./src/allmydata/test/test_dirnode.py 1620 |
---|
1056 | return n.init_from_cap(cap) |
---|
1057 | |
---|
1058 | |
---|
1059 | -class Deleter(GridTestMixin, unittest.TestCase): |
---|
1060 | +class Deleter(GridTestMixin, testutil.ReallyEqualMixin, unittest.TestCase): |
---|
1061 | timeout = 3600 # It takes longer than 433 seconds on Zandr's ARM box. |
---|
1062 | def test_retry(self): |
---|
1063 | # ticket #550, a dirnode.delete which experiences an |
---|
1064 | hunk ./src/allmydata/test/test_uri.py 7 |
---|
1065 | from allmydata.util import hashutil, base32 |
---|
1066 | from allmydata.interfaces import IURI, IFileURI, IDirnodeURI, IMutableFileURI, \ |
---|
1067 | IVerifierURI, CapConstraintError |
---|
1068 | +import allmydata.test.common_util as testutil |
---|
1069 | |
---|
1070 | hunk ./src/allmydata/test/test_uri.py 9 |
---|
1071 | -class Literal(unittest.TestCase): |
---|
1072 | +class Literal(testutil.ReallyEqualMixin, unittest.TestCase): |
---|
1073 | def _help_test(self, data): |
---|
1074 | u = uri.LiteralFileURI(data) |
---|
1075 | self.failUnless(IURI.providedBy(u)) |
---|
1076 | hunk ./src/allmydata/test/test_uri.py 15 |
---|
1077 | self.failUnless(IFileURI.providedBy(u)) |
---|
1078 | self.failIf(IDirnodeURI.providedBy(u)) |
---|
1079 | - self.failUnlessEqual(u.data, data) |
---|
1080 | - self.failUnlessEqual(u.get_size(), len(data)) |
---|
1081 | + self.failUnlessReallyEqual(u.data, data) |
---|
1082 | + self.failUnlessReallyEqual(u.get_size(), len(data)) |
---|
1083 | self.failUnless(u.is_readonly()) |
---|
1084 | self.failIf(u.is_mutable()) |
---|
1085 | |
---|
1086 | hunk ./src/allmydata/test/test_uri.py 24 |
---|
1087 | self.failUnless(IURI.providedBy(u2)) |
---|
1088 | self.failUnless(IFileURI.providedBy(u2)) |
---|
1089 | self.failIf(IDirnodeURI.providedBy(u2)) |
---|
1090 | - self.failUnlessEqual(u2.data, data) |
---|
1091 | - self.failUnlessEqual(u2.get_size(), len(data)) |
---|
1092 | + self.failUnlessReallyEqual(u2.data, data) |
---|
1093 | + self.failUnlessReallyEqual(u2.get_size(), len(data)) |
---|
1094 | self.failUnless(u2.is_readonly()) |
---|
1095 | self.failIf(u2.is_mutable()) |
---|
1096 | |
---|
1097 | hunk ./src/allmydata/test/test_uri.py 32 |
---|
1098 | u2i = uri.from_string(u.to_string(), deep_immutable=True) |
---|
1099 | self.failUnless(IFileURI.providedBy(u2i)) |
---|
1100 | self.failIf(IDirnodeURI.providedBy(u2i)) |
---|
1101 | - self.failUnlessEqual(u2i.data, data) |
---|
1102 | - self.failUnlessEqual(u2i.get_size(), len(data)) |
---|
1103 | + self.failUnlessReallyEqual(u2i.data, data) |
---|
1104 | + self.failUnlessReallyEqual(u2i.get_size(), len(data)) |
---|
1105 | self.failUnless(u2i.is_readonly()) |
---|
1106 | self.failIf(u2i.is_mutable()) |
---|
1107 | |
---|
1108 | hunk ./src/allmydata/test/test_uri.py 39 |
---|
1109 | u3 = u.get_readonly() |
---|
1110 | self.failUnlessIdentical(u, u3) |
---|
1111 | - self.failUnlessEqual(u.get_verify_cap(), None) |
---|
1112 | + self.failUnlessReallyEqual(u.get_verify_cap(), None) |
---|
1113 | |
---|
1114 | he = u.to_human_encoding() |
---|
1115 | u_h = uri.LiteralFileURI.init_from_human_encoding(he) |
---|
1116 | hunk ./src/allmydata/test/test_uri.py 43 |
---|
1117 | - self.failUnlessEqual(u, u_h) |
---|
1118 | + self.failUnlessReallyEqual(u, u_h) |
---|
1119 | |
---|
1120 | def test_empty(self): |
---|
1121 | data = "" # This data is some *very* small data! |
---|
1122 | hunk ./src/allmydata/test/test_uri.py 57 |
---|
1123 | data = "This contains \x00 and URI:LIT: and \n, oh my." |
---|
1124 | return self._help_test(data) |
---|
1125 | |
---|
1126 | -class Compare(unittest.TestCase): |
---|
1127 | +class Compare(testutil.ReallyEqualMixin, unittest.TestCase): |
---|
1128 | def test_compare(self): |
---|
1129 | lit1 = uri.LiteralFileURI("some data") |
---|
1130 | fileURI = 'URI:CHK:f5ahxa25t4qkktywz6teyfvcx4:opuioq7tj2y6idzfp6cazehtmgs5fdcebcz3cygrxyydvcozrmeq:3:10:345834' |
---|
1131 | hunk ./src/allmydata/test/test_uri.py 65 |
---|
1132 | chk2 = uri.CHKFileURI.init_from_string(fileURI) |
---|
1133 | unk = uri.UnknownURI("lafs://from_the_future") |
---|
1134 | self.failIfEqual(lit1, chk1) |
---|
1135 | - self.failUnlessEqual(chk1, chk2) |
---|
1136 | + self.failUnlessReallyEqual(chk1, chk2) |
---|
1137 | self.failIfEqual(chk1, "not actually a URI") |
---|
1138 | # these should be hashable too |
---|
1139 | s = set([lit1, chk1, chk2, unk]) |
---|
1140 | hunk ./src/allmydata/test/test_uri.py 69 |
---|
1141 | - self.failUnlessEqual(len(s), 3) # since chk1==chk2 |
---|
1142 | + self.failUnlessReallyEqual(len(s), 3) # since chk1==chk2 |
---|
1143 | |
---|
1144 | def test_is_uri(self): |
---|
1145 | lit1 = uri.LiteralFileURI("some data").to_string() |
---|
1146 | hunk ./src/allmydata/test/test_uri.py 93 |
---|
1147 | self.failIf(uri.has_uri_prefix(None)) |
---|
1148 | self.failIf(uri.has_uri_prefix("foo")) |
---|
1149 | |
---|
1150 | -class CHKFile(unittest.TestCase): |
---|
1151 | +class CHKFile(testutil.ReallyEqualMixin, unittest.TestCase): |
---|
1152 | def test_pack(self): |
---|
1153 | key = "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f" |
---|
1154 | storage_index = hashutil.storage_index_hash(key) |
---|
1155 | hunk ./src/allmydata/test/test_uri.py 106 |
---|
1156 | needed_shares=needed_shares, |
---|
1157 | total_shares=total_shares, |
---|
1158 | size=size) |
---|
1159 | - self.failUnlessEqual(u.get_storage_index(), storage_index) |
---|
1160 | - self.failUnlessEqual(u.key, key) |
---|
1161 | - self.failUnlessEqual(u.uri_extension_hash, uri_extension_hash) |
---|
1162 | - self.failUnlessEqual(u.needed_shares, needed_shares) |
---|
1163 | - self.failUnlessEqual(u.total_shares, total_shares) |
---|
1164 | - self.failUnlessEqual(u.size, size) |
---|
1165 | + self.failUnlessReallyEqual(u.get_storage_index(), storage_index) |
---|
1166 | + self.failUnlessReallyEqual(u.key, key) |
---|
1167 | + self.failUnlessReallyEqual(u.uri_extension_hash, uri_extension_hash) |
---|
1168 | + self.failUnlessReallyEqual(u.needed_shares, needed_shares) |
---|
1169 | + self.failUnlessReallyEqual(u.total_shares, total_shares) |
---|
1170 | + self.failUnlessReallyEqual(u.size, size) |
---|
1171 | self.failUnless(u.is_readonly()) |
---|
1172 | self.failIf(u.is_mutable()) |
---|
1173 | self.failUnless(IURI.providedBy(u)) |
---|
1174 | hunk ./src/allmydata/test/test_uri.py 117 |
---|
1175 | self.failUnless(IFileURI.providedBy(u)) |
---|
1176 | self.failIf(IDirnodeURI.providedBy(u)) |
---|
1177 | - self.failUnlessEqual(u.get_size(), 1234) |
---|
1178 | + self.failUnlessReallyEqual(u.get_size(), 1234) |
---|
1179 | |
---|
1180 | u_ro = u.get_readonly() |
---|
1181 | self.failUnlessIdentical(u, u_ro) |
---|
1182 | hunk ./src/allmydata/test/test_uri.py 122 |
---|
1183 | he = u.to_human_encoding() |
---|
1184 | - self.failUnlessEqual(he, "http://127.0.0.1:3456/uri/" + u.to_string()) |
---|
1185 | - self.failUnlessEqual(uri.CHKFileURI.init_from_human_encoding(he), u) |
---|
1186 | + self.failUnlessReallyEqual(he, "http://127.0.0.1:3456/uri/" + u.to_string()) |
---|
1187 | + self.failUnlessReallyEqual(uri.CHKFileURI.init_from_human_encoding(he), u) |
---|
1188 | |
---|
1189 | u2 = uri.from_string(u.to_string()) |
---|
1190 | hunk ./src/allmydata/test/test_uri.py 126 |
---|
1191 | - self.failUnlessEqual(u2.get_storage_index(), storage_index) |
---|
1192 | - self.failUnlessEqual(u2.key, key) |
---|
1193 | - self.failUnlessEqual(u2.uri_extension_hash, uri_extension_hash) |
---|
1194 | - self.failUnlessEqual(u2.needed_shares, needed_shares) |
---|
1195 | - self.failUnlessEqual(u2.total_shares, total_shares) |
---|
1196 | - self.failUnlessEqual(u2.size, size) |
---|
1197 | + self.failUnlessReallyEqual(u2.get_storage_index(), storage_index) |
---|
1198 | + self.failUnlessReallyEqual(u2.key, key) |
---|
1199 | + self.failUnlessReallyEqual(u2.uri_extension_hash, uri_extension_hash) |
---|
1200 | + self.failUnlessReallyEqual(u2.needed_shares, needed_shares) |
---|
1201 | + self.failUnlessReallyEqual(u2.total_shares, total_shares) |
---|
1202 | + self.failUnlessReallyEqual(u2.size, size) |
---|
1203 | self.failUnless(u2.is_readonly()) |
---|
1204 | self.failIf(u2.is_mutable()) |
---|
1205 | self.failUnless(IURI.providedBy(u2)) |
---|
1206 | hunk ./src/allmydata/test/test_uri.py 137 |
---|
1207 | self.failUnless(IFileURI.providedBy(u2)) |
---|
1208 | self.failIf(IDirnodeURI.providedBy(u2)) |
---|
1209 | - self.failUnlessEqual(u2.get_size(), 1234) |
---|
1210 | + self.failUnlessReallyEqual(u2.get_size(), 1234) |
---|
1211 | |
---|
1212 | u2i = uri.from_string(u.to_string(), deep_immutable=True) |
---|
1213 | hunk ./src/allmydata/test/test_uri.py 140 |
---|
1214 | - self.failUnlessEqual(u.to_string(), u2i.to_string()) |
---|
1215 | + self.failUnlessReallyEqual(u.to_string(), u2i.to_string()) |
---|
1216 | u2ro = uri.from_string(uri.ALLEGED_READONLY_PREFIX + u.to_string()) |
---|
1217 | hunk ./src/allmydata/test/test_uri.py 142 |
---|
1218 | - self.failUnlessEqual(u.to_string(), u2ro.to_string()) |
---|
1219 | + self.failUnlessReallyEqual(u.to_string(), u2ro.to_string()) |
---|
1220 | u2imm = uri.from_string(uri.ALLEGED_IMMUTABLE_PREFIX + u.to_string()) |
---|
1221 | hunk ./src/allmydata/test/test_uri.py 144 |
---|
1222 | - self.failUnlessEqual(u.to_string(), u2imm.to_string()) |
---|
1223 | + self.failUnlessReallyEqual(u.to_string(), u2imm.to_string()) |
---|
1224 | |
---|
1225 | v = u.get_verify_cap() |
---|
1226 | self.failUnless(isinstance(v.to_string(), str)) |
---|
1227 | hunk ./src/allmydata/test/test_uri.py 152 |
---|
1228 | self.failIf(v.is_mutable()) |
---|
1229 | |
---|
1230 | v2 = uri.from_string(v.to_string()) |
---|
1231 | - self.failUnlessEqual(v, v2) |
---|
1232 | + self.failUnlessReallyEqual(v, v2) |
---|
1233 | he = v.to_human_encoding() |
---|
1234 | v2_h = uri.CHKFileVerifierURI.init_from_human_encoding(he) |
---|
1235 | hunk ./src/allmydata/test/test_uri.py 155 |
---|
1236 | - self.failUnlessEqual(v2, v2_h) |
---|
1237 | + self.failUnlessReallyEqual(v2, v2_h) |
---|
1238 | |
---|
1239 | v3 = uri.CHKFileVerifierURI(storage_index="\x00"*16, |
---|
1240 | uri_extension_hash="\x00"*32, |
---|
1241 | hunk ./src/allmydata/test/test_uri.py 196 |
---|
1242 | ) |
---|
1243 | |
---|
1244 | |
---|
1245 | -class Extension(unittest.TestCase): |
---|
1246 | +class Extension(testutil.ReallyEqualMixin, unittest.TestCase): |
---|
1247 | def test_pack(self): |
---|
1248 | data = {"stuff": "value", |
---|
1249 | "size": 12, |
---|
1250 | hunk ./src/allmydata/test/test_uri.py 205 |
---|
1251 | } |
---|
1252 | ext = uri.pack_extension(data) |
---|
1253 | d = uri.unpack_extension(ext) |
---|
1254 | - self.failUnlessEqual(d["stuff"], "value") |
---|
1255 | - self.failUnlessEqual(d["size"], 12) |
---|
1256 | - self.failUnlessEqual(d["big_hash"], hashutil.tagged_hash("foo", "bar")) |
---|
1257 | + self.failUnlessReallyEqual(d["stuff"], "value") |
---|
1258 | + self.failUnlessReallyEqual(d["size"], 12) |
---|
1259 | + self.failUnlessReallyEqual(d["big_hash"], hashutil.tagged_hash("foo", "bar")) |
---|
1260 | |
---|
1261 | readable = uri.unpack_extension_readable(ext) |
---|
1262 | hunk ./src/allmydata/test/test_uri.py 210 |
---|
1263 | - self.failUnlessEqual(readable["needed_shares"], 3) |
---|
1264 | - self.failUnlessEqual(readable["stuff"], "value") |
---|
1265 | - self.failUnlessEqual(readable["size"], 12) |
---|
1266 | - self.failUnlessEqual(readable["big_hash"], |
---|
1267 | + self.failUnlessReallyEqual(readable["needed_shares"], 3) |
---|
1268 | + self.failUnlessReallyEqual(readable["stuff"], "value") |
---|
1269 | + self.failUnlessReallyEqual(readable["size"], 12) |
---|
1270 | + self.failUnlessReallyEqual(readable["big_hash"], |
---|
1271 | base32.b2a(hashutil.tagged_hash("foo", "bar"))) |
---|
1272 | hunk ./src/allmydata/test/test_uri.py 215 |
---|
1273 | - self.failUnlessEqual(readable["UEB_hash"], |
---|
1274 | + self.failUnlessReallyEqual(readable["UEB_hash"], |
---|
1275 | base32.b2a(hashutil.uri_extension_hash(ext))) |
---|
1276 | |
---|
1277 | hunk ./src/allmydata/test/test_uri.py 218 |
---|
1278 | -class Unknown(unittest.TestCase): |
---|
1279 | +class Unknown(testutil.ReallyEqualMixin, unittest.TestCase): |
---|
1280 | def test_from_future(self): |
---|
1281 | # any URI type that we don't recognize should be treated as unknown |
---|
1282 | future_uri = "I am a URI from the future. Whatever you do, don't " |
---|
1283 | hunk ./src/allmydata/test/test_uri.py 224 |
---|
1284 | u = uri.from_string(future_uri) |
---|
1285 | self.failUnless(isinstance(u, uri.UnknownURI)) |
---|
1286 | - self.failUnlessEqual(u.to_string(), future_uri) |
---|
1287 | + self.failUnlessReallyEqual(u.to_string(), future_uri) |
---|
1288 | self.failUnless(u.get_readonly() is None) |
---|
1289 | self.failUnless(u.get_error() is None) |
---|
1290 | |
---|
1291 | hunk ./src/allmydata/test/test_uri.py 229 |
---|
1292 | u2 = uri.UnknownURI(future_uri, error=CapConstraintError("...")) |
---|
1293 | - self.failUnlessEqual(u.to_string(), future_uri) |
---|
1294 | + self.failUnlessReallyEqual(u.to_string(), future_uri) |
---|
1295 | self.failUnless(u2.get_readonly() is None) |
---|
1296 | self.failUnless(isinstance(u2.get_error(), CapConstraintError)) |
---|
1297 | |
---|
1298 | hunk ./src/allmydata/test/test_uri.py 233 |
---|
1299 | -class Constraint(unittest.TestCase): |
---|
1300 | + # Future caps might have non-ASCII chars in them. (Or maybe not, who can tell about the future?) |
---|
1301 | + future_uri = u"I am a cap from the \u263A future. Whatever you ".encode('utf-8') |
---|
1302 | + u = uri.from_string(future_uri) |
---|
1303 | + self.failUnless(isinstance(u, uri.UnknownURI)) |
---|
1304 | + self.failUnlessReallyEqual(u.to_string(), future_uri) |
---|
1305 | + self.failUnless(u.get_readonly() is None) |
---|
1306 | + self.failUnless(u.get_error() is None) |
---|
1307 | + |
---|
1308 | + u2 = uri.UnknownURI(future_uri, error=CapConstraintError("...")) |
---|
1309 | + self.failUnlessReallyEqual(u.to_string(), future_uri) |
---|
1310 | + self.failUnless(u2.get_readonly() is None) |
---|
1311 | + self.failUnless(isinstance(u2.get_error(), CapConstraintError)) |
---|
1312 | + |
---|
1313 | +class Constraint(testutil.ReallyEqualMixin, unittest.TestCase): |
---|
1314 | def test_constraint(self): |
---|
1315 | good="http://127.0.0.1:3456/uri/URI%3ADIR2%3Agh3l5rbvnv2333mrfvalmjfr4i%3Alz6l7u3z3b7g37s4zkdmfpx5ly4ib4m6thrpbusi6ys62qtc6mma/" |
---|
1316 | uri.DirectoryURI.init_from_human_encoding(good) |
---|
1317 | hunk ./src/allmydata/test/test_uri.py 257 |
---|
1318 | fileURI = 'URI:CHK:gh3l5rbvnv2333mrfvalmjfr4i:lz6l7u3z3b7g37s4zkdmfpx5ly4ib4m6thrpbusi6ys62qtc6mma:3:10:345834' |
---|
1319 | uri.CHKFileURI.init_from_string(fileURI) |
---|
1320 | |
---|
1321 | -class Mutable(unittest.TestCase): |
---|
1322 | +class Mutable(testutil.ReallyEqualMixin, unittest.TestCase): |
---|
1323 | def test_pack(self): |
---|
1324 | writekey = "\x01" * 16 |
---|
1325 | fingerprint = "\x02" * 32 |
---|
1326 | hunk ./src/allmydata/test/test_uri.py 263 |
---|
1327 | |
---|
1328 | u = uri.WriteableSSKFileURI(writekey, fingerprint) |
---|
1329 | - self.failUnlessEqual(u.writekey, writekey) |
---|
1330 | - self.failUnlessEqual(u.fingerprint, fingerprint) |
---|
1331 | + self.failUnlessReallyEqual(u.writekey, writekey) |
---|
1332 | + self.failUnlessReallyEqual(u.fingerprint, fingerprint) |
---|
1333 | self.failIf(u.is_readonly()) |
---|
1334 | self.failUnless(u.is_mutable()) |
---|
1335 | self.failUnless(IURI.providedBy(u)) |
---|
1336 | hunk ./src/allmydata/test/test_uri.py 274 |
---|
1337 | |
---|
1338 | he = u.to_human_encoding() |
---|
1339 | u_h = uri.WriteableSSKFileURI.init_from_human_encoding(he) |
---|
1340 | - self.failUnlessEqual(u, u_h) |
---|
1341 | + self.failUnlessReallyEqual(u, u_h) |
---|
1342 | |
---|
1343 | u2 = uri.from_string(u.to_string()) |
---|
1344 | hunk ./src/allmydata/test/test_uri.py 277 |
---|
1345 | - self.failUnlessEqual(u2.writekey, writekey) |
---|
1346 | - self.failUnlessEqual(u2.fingerprint, fingerprint) |
---|
1347 | + self.failUnlessReallyEqual(u2.writekey, writekey) |
---|
1348 | + self.failUnlessReallyEqual(u2.fingerprint, fingerprint) |
---|
1349 | self.failIf(u2.is_readonly()) |
---|
1350 | self.failUnless(u2.is_mutable()) |
---|
1351 | self.failUnless(IURI.providedBy(u2)) |
---|
1352 | hunk ./src/allmydata/test/test_uri.py 294 |
---|
1353 | |
---|
1354 | u3 = u2.get_readonly() |
---|
1355 | readkey = hashutil.ssk_readkey_hash(writekey) |
---|
1356 | - self.failUnlessEqual(u3.fingerprint, fingerprint) |
---|
1357 | - self.failUnlessEqual(u3.readkey, readkey) |
---|
1358 | + self.failUnlessReallyEqual(u3.fingerprint, fingerprint) |
---|
1359 | + self.failUnlessReallyEqual(u3.readkey, readkey) |
---|
1360 | self.failUnless(u3.is_readonly()) |
---|
1361 | self.failUnless(u3.is_mutable()) |
---|
1362 | self.failUnless(IURI.providedBy(u3)) |
---|
1363 | hunk ./src/allmydata/test/test_uri.py 305 |
---|
1364 | u3i = uri.from_string(u3.to_string(), deep_immutable=True) |
---|
1365 | self.failUnless(isinstance(u3i, uri.UnknownURI), u3i) |
---|
1366 | u3ro = uri.from_string(uri.ALLEGED_READONLY_PREFIX + u3.to_string()) |
---|
1367 | - self.failUnlessEqual(u3.to_string(), u3ro.to_string()) |
---|
1368 | + self.failUnlessReallyEqual(u3.to_string(), u3ro.to_string()) |
---|
1369 | u3imm = uri.from_string(uri.ALLEGED_IMMUTABLE_PREFIX + u3.to_string()) |
---|
1370 | self.failUnless(isinstance(u3imm, uri.UnknownURI), u3imm) |
---|
1371 | |
---|
1372 | hunk ./src/allmydata/test/test_uri.py 311 |
---|
1373 | he = u3.to_human_encoding() |
---|
1374 | u3_h = uri.ReadonlySSKFileURI.init_from_human_encoding(he) |
---|
1375 | - self.failUnlessEqual(u3, u3_h) |
---|
1376 | + self.failUnlessReallyEqual(u3, u3_h) |
---|
1377 | |
---|
1378 | u4 = uri.ReadonlySSKFileURI(readkey, fingerprint) |
---|
1379 | hunk ./src/allmydata/test/test_uri.py 314 |
---|
1380 | - self.failUnlessEqual(u4.fingerprint, fingerprint) |
---|
1381 | - self.failUnlessEqual(u4.readkey, readkey) |
---|
1382 | + self.failUnlessReallyEqual(u4.fingerprint, fingerprint) |
---|
1383 | + self.failUnlessReallyEqual(u4.readkey, readkey) |
---|
1384 | self.failUnless(u4.is_readonly()) |
---|
1385 | self.failUnless(u4.is_mutable()) |
---|
1386 | self.failUnless(IURI.providedBy(u4)) |
---|
1387 | hunk ./src/allmydata/test/test_uri.py 325 |
---|
1388 | u4i = uri.from_string(u4.to_string(), deep_immutable=True) |
---|
1389 | self.failUnless(isinstance(u4i, uri.UnknownURI), u4i) |
---|
1390 | u4ro = uri.from_string(uri.ALLEGED_READONLY_PREFIX + u4.to_string()) |
---|
1391 | - self.failUnlessEqual(u4.to_string(), u4ro.to_string()) |
---|
1392 | + self.failUnlessReallyEqual(u4.to_string(), u4ro.to_string()) |
---|
1393 | u4imm = uri.from_string(uri.ALLEGED_IMMUTABLE_PREFIX + u4.to_string()) |
---|
1394 | self.failUnless(isinstance(u4imm, uri.UnknownURI), u4imm) |
---|
1395 | |
---|
1396 | hunk ./src/allmydata/test/test_uri.py 330 |
---|
1397 | u4a = uri.from_string(u4.to_string()) |
---|
1398 | - self.failUnlessEqual(u4a, u4) |
---|
1399 | + self.failUnlessReallyEqual(u4a, u4) |
---|
1400 | self.failUnless("ReadonlySSKFileURI" in str(u4a)) |
---|
1401 | self.failUnlessIdentical(u4a.get_readonly(), u4a) |
---|
1402 | |
---|
1403 | hunk ./src/allmydata/test/test_uri.py 336 |
---|
1404 | u5 = u4.get_verify_cap() |
---|
1405 | self.failUnless(IVerifierURI.providedBy(u5)) |
---|
1406 | - self.failUnlessEqual(u5.get_storage_index(), u.get_storage_index()) |
---|
1407 | + self.failUnlessReallyEqual(u5.get_storage_index(), u.get_storage_index()) |
---|
1408 | u7 = u.get_verify_cap() |
---|
1409 | self.failUnless(IVerifierURI.providedBy(u7)) |
---|
1410 | hunk ./src/allmydata/test/test_uri.py 339 |
---|
1411 | - self.failUnlessEqual(u7.get_storage_index(), u.get_storage_index()) |
---|
1412 | + self.failUnlessReallyEqual(u7.get_storage_index(), u.get_storage_index()) |
---|
1413 | |
---|
1414 | he = u5.to_human_encoding() |
---|
1415 | u5_h = uri.SSKVerifierURI.init_from_human_encoding(he) |
---|
1416 | hunk ./src/allmydata/test/test_uri.py 343 |
---|
1417 | - self.failUnlessEqual(u5, u5_h) |
---|
1418 | + self.failUnlessReallyEqual(u5, u5_h) |
---|
1419 | |
---|
1420 | |
---|
1421 | hunk ./src/allmydata/test/test_uri.py 346 |
---|
1422 | -class Dirnode(unittest.TestCase): |
---|
1423 | +class Dirnode(testutil.ReallyEqualMixin, unittest.TestCase): |
---|
1424 | def test_pack(self): |
---|
1425 | writekey = "\x01" * 16 |
---|
1426 | fingerprint = "\x02" * 32 |
---|
1427 | hunk ./src/allmydata/test/test_uri.py 364 |
---|
1428 | self.failIf(u1_filenode.is_readonly()) |
---|
1429 | |
---|
1430 | u2 = uri.from_string(u1.to_string()) |
---|
1431 | - self.failUnlessEqual(u1.to_string(), u2.to_string()) |
---|
1432 | + self.failUnlessReallyEqual(u1.to_string(), u2.to_string()) |
---|
1433 | self.failIf(u2.is_readonly()) |
---|
1434 | self.failUnless(u2.is_mutable()) |
---|
1435 | self.failUnless(IURI.providedBy(u2)) |
---|
1436 | hunk ./src/allmydata/test/test_uri.py 395 |
---|
1437 | self.failUnlessIdentical(u3a, u3a.get_readonly()) |
---|
1438 | |
---|
1439 | u4 = uri.ReadonlyDirectoryURI(u2._filenode_uri.get_readonly()) |
---|
1440 | - self.failUnlessEqual(u4.to_string(), u3.to_string()) |
---|
1441 | + self.failUnlessReallyEqual(u4.to_string(), u3.to_string()) |
---|
1442 | self.failUnless(u4.is_readonly()) |
---|
1443 | self.failUnless(u4.is_mutable()) |
---|
1444 | self.failUnless(IURI.providedBy(u4)) |
---|
1445 | hunk ./src/allmydata/test/test_uri.py 412 |
---|
1446 | ] |
---|
1447 | for v in verifiers: |
---|
1448 | self.failUnless(IVerifierURI.providedBy(v)) |
---|
1449 | - self.failUnlessEqual(v._filenode_uri, |
---|
1450 | + self.failUnlessReallyEqual(v._filenode_uri, |
---|
1451 | u1.get_verify_cap()._filenode_uri) |
---|
1452 | |
---|
1453 | def test_immutable(self): |
---|
1454 | hunk ./src/allmydata/test/test_uri.py 428 |
---|
1455 | total_shares=total_shares, |
---|
1456 | size=size) |
---|
1457 | fncap = fnuri.to_string() |
---|
1458 | - self.failUnlessEqual(fncap, "URI:CHK:aeaqcaibaeaqcaibaeaqcaibae:nf3nimquen7aeqm36ekgxomalstenpkvsdmf6fplj7swdatbv5oa:3:10:1234") |
---|
1459 | + self.failUnlessReallyEqual(fncap, "URI:CHK:aeaqcaibaeaqcaibaeaqcaibae:nf3nimquen7aeqm36ekgxomalstenpkvsdmf6fplj7swdatbv5oa:3:10:1234") |
---|
1460 | u1 = uri.ImmutableDirectoryURI(fnuri) |
---|
1461 | self.failUnless(u1.is_readonly()) |
---|
1462 | self.failIf(u1.is_mutable()) |
---|
1463 | hunk ./src/allmydata/test/test_uri.py 439 |
---|
1464 | u1_filenode = u1.get_filenode_cap() |
---|
1465 | self.failIf(u1_filenode.is_mutable()) |
---|
1466 | self.failUnless(u1_filenode.is_readonly()) |
---|
1467 | - self.failUnlessEqual(u1_filenode.to_string(), fncap) |
---|
1468 | + self.failUnlessReallyEqual(u1_filenode.to_string(), fncap) |
---|
1469 | self.failUnless(str(u1)) |
---|
1470 | |
---|
1471 | u2 = uri.from_string(u1.to_string()) |
---|
1472 | hunk ./src/allmydata/test/test_uri.py 443 |
---|
1473 | - self.failUnlessEqual(u1.to_string(), u2.to_string()) |
---|
1474 | + self.failUnlessReallyEqual(u1.to_string(), u2.to_string()) |
---|
1475 | self.failUnless(u2.is_readonly()) |
---|
1476 | self.failIf(u2.is_mutable()) |
---|
1477 | self.failUnless(IURI.providedBy(u2)) |
---|
1478 | hunk ./src/allmydata/test/test_uri.py 451 |
---|
1479 | self.failUnless(IDirnodeURI.providedBy(u2)) |
---|
1480 | |
---|
1481 | u2i = uri.from_string(u1.to_string(), deep_immutable=True) |
---|
1482 | - self.failUnlessEqual(u1.to_string(), u2i.to_string()) |
---|
1483 | + self.failUnlessReallyEqual(u1.to_string(), u2i.to_string()) |
---|
1484 | |
---|
1485 | u3 = u2.get_readonly() |
---|
1486 | hunk ./src/allmydata/test/test_uri.py 454 |
---|
1487 | - self.failUnlessEqual(u3.to_string(), u2.to_string()) |
---|
1488 | + self.failUnlessReallyEqual(u3.to_string(), u2.to_string()) |
---|
1489 | self.failUnless(str(u3)) |
---|
1490 | |
---|
1491 | u3i = uri.from_string(u2.to_string(), deep_immutable=True) |
---|
1492 | hunk ./src/allmydata/test/test_uri.py 458 |
---|
1493 | - self.failUnlessEqual(u2.to_string(), u3i.to_string()) |
---|
1494 | + self.failUnlessReallyEqual(u2.to_string(), u3i.to_string()) |
---|
1495 | |
---|
1496 | u2_verifier = u2.get_verify_cap() |
---|
1497 | self.failUnless(isinstance(u2_verifier, |
---|
1498 | hunk ./src/allmydata/test/test_uri.py 472 |
---|
1499 | self.failUnless(IVerifierURI.providedBy(u2_verifier_fileuri)) |
---|
1500 | u2vfs = u2_verifier_fileuri.to_string() |
---|
1501 | # URI:CHK-Verifier:$key:$ueb:$k:$n:$size |
---|
1502 | - self.failUnlessEqual(u2vfs, fnuri.get_verify_cap().to_string()) |
---|
1503 | - self.failUnlessEqual(u2vs[len("URI:DIR2-"):], u2vfs[len("URI:"):]) |
---|
1504 | + self.failUnlessReallyEqual(u2vfs, fnuri.get_verify_cap().to_string()) |
---|
1505 | + self.failUnlessReallyEqual(u2vs[len("URI:DIR2-"):], u2vfs[len("URI:"):]) |
---|
1506 | self.failUnless(str(u2_verifier)) |
---|
1507 | |
---|
1508 | def test_literal(self): |
---|
1509 | hunk ./src/allmydata/test/test_uri.py 480 |
---|
1510 | u0 = uri.LiteralFileURI("data") |
---|
1511 | u1 = uri.LiteralDirectoryURI(u0) |
---|
1512 | self.failUnless(str(u1)) |
---|
1513 | - self.failUnlessEqual(u1.to_string(), "URI:DIR2-LIT:mrqxiyi") |
---|
1514 | + self.failUnlessReallyEqual(u1.to_string(), "URI:DIR2-LIT:mrqxiyi") |
---|
1515 | self.failUnless(u1.is_readonly()) |
---|
1516 | self.failIf(u1.is_mutable()) |
---|
1517 | self.failUnless(IURI.providedBy(u1)) |
---|
1518 | hunk ./src/allmydata/test/test_uri.py 486 |
---|
1519 | self.failIf(IFileURI.providedBy(u1)) |
---|
1520 | self.failUnless(IDirnodeURI.providedBy(u1)) |
---|
1521 | - self.failUnlessEqual(u1.get_verify_cap(), None) |
---|
1522 | - self.failUnlessEqual(u1.get_storage_index(), None) |
---|
1523 | - self.failUnlessEqual(u1.abbrev_si(), "<LIT>") |
---|
1524 | + self.failUnlessReallyEqual(u1.get_verify_cap(), None) |
---|
1525 | + self.failUnlessReallyEqual(u1.get_storage_index(), None) |
---|
1526 | + self.failUnlessReallyEqual(u1.abbrev_si(), "<LIT>") |
---|
1527 | hunk ./src/allmydata/test/test_web.py 1 |
---|
1528 | + |
---|
1529 | import os.path, re, urllib |
---|
1530 | import simplejson |
---|
1531 | from StringIO import StringIO |
---|
1532 | hunk ./src/allmydata/test/test_web.py 39 |
---|
1533 | |
---|
1534 | timeout = 480 # Most of these take longer than 240 seconds on Francois's arm box. |
---|
1535 | |
---|
1536 | -unknown_rwcap = "lafs://from_the_future" |
---|
1537 | -unknown_rocap = "ro.lafs://readonly_from_the_future" |
---|
1538 | -unknown_immcap = "imm.lafs://immutable_from_the_future" |
---|
1539 | +unknown_rwcap = u"lafs://from_the_future_rw_\u263A".encode('utf-8') |
---|
1540 | +unknown_rocap = u"ro.lafs://readonly_from_the_future_ro_\u263A".encode('utf-8') |
---|
1541 | +unknown_immcap = u"imm.lafs://immutable_from_the_future_imm_\u263A".encode('utf-8') |
---|
1542 | |
---|
1543 | class FakeStatsProvider: |
---|
1544 | def get_stats(self): |
---|
1545 | hunk ./src/allmydata/test/test_web.py 212 |
---|
1546 | return self.s.stopService() |
---|
1547 | |
---|
1548 | def failUnlessIsBarDotTxt(self, res): |
---|
1549 | - self.failUnlessEqual(res, self.BAR_CONTENTS, res) |
---|
1550 | + self.failUnlessReallyEqual(res, self.BAR_CONTENTS, res) |
---|
1551 | |
---|
1552 | def failUnlessIsBarJSON(self, res): |
---|
1553 | data = simplejson.loads(res) |
---|
1554 | hunk ./src/allmydata/test/test_web.py 217 |
---|
1555 | self.failUnless(isinstance(data, list)) |
---|
1556 | - self.failUnlessEqual(data[0], u"filenode") |
---|
1557 | + self.failUnlessReallyEqual(data[0], "filenode") |
---|
1558 | self.failUnless(isinstance(data[1], dict)) |
---|
1559 | self.failIf(data[1]["mutable"]) |
---|
1560 | self.failIf("rw_uri" in data[1]) # immutable |
---|
1561 | hunk ./src/allmydata/test/test_web.py 221 |
---|
1562 | - self.failUnlessEqual(data[1]["ro_uri"], self._bar_txt_uri) |
---|
1563 | - self.failUnlessEqual(data[1]["verify_uri"], self._bar_txt_verifycap) |
---|
1564 | - self.failUnlessEqual(data[1]["size"], len(self.BAR_CONTENTS)) |
---|
1565 | + self.failUnlessReallyEqual(data[1]["ro_uri"], self._bar_txt_uri) |
---|
1566 | + self.failUnlessReallyEqual(data[1]["verify_uri"], self._bar_txt_verifycap) |
---|
1567 | + self.failUnlessReallyEqual(data[1]["size"], len(self.BAR_CONTENTS)) |
---|
1568 | |
---|
1569 | def failUnlessIsFooJSON(self, res): |
---|
1570 | data = simplejson.loads(res) |
---|
1571 | hunk ./src/allmydata/test/test_web.py 228 |
---|
1572 | self.failUnless(isinstance(data, list)) |
---|
1573 | - self.failUnlessEqual(data[0], "dirnode", res) |
---|
1574 | + self.failUnlessReallyEqual(data[0], "dirnode", res) |
---|
1575 | self.failUnless(isinstance(data[1], dict)) |
---|
1576 | self.failUnless(data[1]["mutable"]) |
---|
1577 | self.failUnless("rw_uri" in data[1]) # mutable |
---|
1578 | hunk ./src/allmydata/test/test_web.py 232 |
---|
1579 | - self.failUnlessEqual(data[1]["rw_uri"], self._foo_uri) |
---|
1580 | - self.failUnlessEqual(data[1]["ro_uri"], self._foo_readonly_uri) |
---|
1581 | - self.failUnlessEqual(data[1]["verify_uri"], self._foo_verifycap) |
---|
1582 | + self.failUnlessReallyEqual(data[1]["rw_uri"], self._foo_uri) |
---|
1583 | + self.failUnlessReallyEqual(data[1]["ro_uri"], self._foo_readonly_uri) |
---|
1584 | + self.failUnlessReallyEqual(data[1]["verify_uri"], self._foo_verifycap) |
---|
1585 | |
---|
1586 | kidnames = sorted([unicode(n) for n in data[1]["children"]]) |
---|
1587 | hunk ./src/allmydata/test/test_web.py 237 |
---|
1588 | - self.failUnlessEqual(kidnames, |
---|
1589 | - [u"bar.txt", u"blockingfile", u"empty", |
---|
1590 | - u"n\u00fc.txt", u"sub"]) |
---|
1591 | + self.failUnlessReallyEqual(kidnames, |
---|
1592 | + [u"bar.txt", u"blockingfile", u"empty", |
---|
1593 | + u"n\u00fc.txt", u"sub"]) |
---|
1594 | kids = dict( [(unicode(name),value) |
---|
1595 | for (name,value) |
---|
1596 | in data[1]["children"].iteritems()] ) |
---|
1597 | hunk ./src/allmydata/test/test_web.py 243 |
---|
1598 | - self.failUnlessEqual(kids[u"sub"][0], "dirnode") |
---|
1599 | + self.failUnlessReallyEqual(kids[u"sub"][0], "dirnode") |
---|
1600 | self.failUnlessIn("metadata", kids[u"sub"][1]) |
---|
1601 | self.failUnlessIn("tahoe", kids[u"sub"][1]["metadata"]) |
---|
1602 | tahoe_md = kids[u"sub"][1]["metadata"]["tahoe"] |
---|
1603 | hunk ./src/allmydata/test/test_web.py 249 |
---|
1604 | self.failUnlessIn("linkcrtime", tahoe_md) |
---|
1605 | self.failUnlessIn("linkmotime", tahoe_md) |
---|
1606 | - self.failUnlessEqual(kids[u"bar.txt"][0], "filenode") |
---|
1607 | - self.failUnlessEqual(kids[u"bar.txt"][1]["size"], len(self.BAR_CONTENTS)) |
---|
1608 | - self.failUnlessEqual(kids[u"bar.txt"][1]["ro_uri"], self._bar_txt_uri) |
---|
1609 | - self.failUnlessEqual(kids[u"bar.txt"][1]["verify_uri"], |
---|
1610 | - self._bar_txt_verifycap) |
---|
1611 | + self.failUnlessReallyEqual(kids[u"bar.txt"][0], "filenode") |
---|
1612 | + self.failUnlessReallyEqual(kids[u"bar.txt"][1]["size"], len(self.BAR_CONTENTS)) |
---|
1613 | + self.failUnlessReallyEqual(kids[u"bar.txt"][1]["ro_uri"], self._bar_txt_uri) |
---|
1614 | + self.failUnlessReallyEqual(kids[u"bar.txt"][1]["verify_uri"], |
---|
1615 | + self._bar_txt_verifycap) |
---|
1616 | self.failUnlessIn("metadata", kids[u"bar.txt"][1]) |
---|
1617 | self.failUnlessIn("tahoe", kids[u"bar.txt"][1]["metadata"]) |
---|
1618 | hunk ./src/allmydata/test/test_web.py 256 |
---|
1619 | - self.failUnlessEqual(kids[u"bar.txt"][1]["metadata"]["tahoe"]["linkcrtime"], |
---|
1620 | - self._bar_txt_metadata["tahoe"]["linkcrtime"]) |
---|
1621 | - self.failUnlessEqual(kids[u"n\u00fc.txt"][1]["ro_uri"], |
---|
1622 | - self._bar_txt_uri) |
---|
1623 | + self.failUnlessReallyEqual(kids[u"bar.txt"][1]["metadata"]["tahoe"]["linkcrtime"], |
---|
1624 | + self._bar_txt_metadata["tahoe"]["linkcrtime"]) |
---|
1625 | + self.failUnlessReallyEqual(kids[u"n\u00fc.txt"][1]["ro_uri"], |
---|
1626 | + self._bar_txt_uri) |
---|
1627 | |
---|
1628 | def GET(self, urlpath, followRedirect=False, return_response=False, |
---|
1629 | **kwargs): |
---|
1630 | hunk ./src/allmydata/test/test_web.py 377 |
---|
1631 | def should404(self, res, which): |
---|
1632 | if isinstance(res, failure.Failure): |
---|
1633 | res.trap(error.Error) |
---|
1634 | - self.failUnlessEqual(res.value.status, "404") |
---|
1635 | + self.failUnlessReallyEqual(res.value.status, "404") |
---|
1636 | else: |
---|
1637 | self.fail("%s was supposed to Error(404), not get '%s'" % |
---|
1638 | (which, res)) |
---|
1639 | hunk ./src/allmydata/test/test_web.py 385 |
---|
1640 | def should302(self, res, which): |
---|
1641 | if isinstance(res, failure.Failure): |
---|
1642 | res.trap(error.Error) |
---|
1643 | - self.failUnlessEqual(res.value.status, "302") |
---|
1644 | + self.failUnlessReallyEqual(res.value.status, "302") |
---|
1645 | else: |
---|
1646 | self.fail("%s was supposed to Error(302), not get '%s'" % |
---|
1647 | (which, res)) |
---|
1648 | hunk ./src/allmydata/test/test_web.py 391 |
---|
1649 | |
---|
1650 | |
---|
1651 | -class Web(WebMixin, WebErrorMixin, testutil.StallMixin, unittest.TestCase): |
---|
1652 | +class Web(WebMixin, WebErrorMixin, testutil.StallMixin, testutil.ReallyEqualMixin, unittest.TestCase): |
---|
1653 | def test_create(self): |
---|
1654 | pass |
---|
1655 | |
---|
1656 | hunk ./src/allmydata/test/test_web.py 538 |
---|
1657 | |
---|
1658 | def test_status_numbers(self): |
---|
1659 | drrm = status.DownloadResultsRendererMixin() |
---|
1660 | - self.failUnlessEqual(drrm.render_time(None, None), "") |
---|
1661 | - self.failUnlessEqual(drrm.render_time(None, 2.5), "2.50s") |
---|
1662 | - self.failUnlessEqual(drrm.render_time(None, 0.25), "250ms") |
---|
1663 | - self.failUnlessEqual(drrm.render_time(None, 0.0021), "2.1ms") |
---|
1664 | - self.failUnlessEqual(drrm.render_time(None, 0.000123), "123us") |
---|
1665 | - self.failUnlessEqual(drrm.render_rate(None, None), "") |
---|
1666 | - self.failUnlessEqual(drrm.render_rate(None, 2500000), "2.50MBps") |
---|
1667 | - self.failUnlessEqual(drrm.render_rate(None, 30100), "30.1kBps") |
---|
1668 | - self.failUnlessEqual(drrm.render_rate(None, 123), "123Bps") |
---|
1669 | + self.failUnlessReallyEqual(drrm.render_time(None, None), "") |
---|
1670 | + self.failUnlessReallyEqual(drrm.render_time(None, 2.5), "2.50s") |
---|
1671 | + self.failUnlessReallyEqual(drrm.render_time(None, 0.25), "250ms") |
---|
1672 | + self.failUnlessReallyEqual(drrm.render_time(None, 0.0021), "2.1ms") |
---|
1673 | + self.failUnlessReallyEqual(drrm.render_time(None, 0.000123), "123us") |
---|
1674 | + self.failUnlessReallyEqual(drrm.render_rate(None, None), "") |
---|
1675 | + self.failUnlessReallyEqual(drrm.render_rate(None, 2500000), "2.50MBps") |
---|
1676 | + self.failUnlessReallyEqual(drrm.render_rate(None, 30100), "30.1kBps") |
---|
1677 | + self.failUnlessReallyEqual(drrm.render_rate(None, 123), "123Bps") |
---|
1678 | |
---|
1679 | urrm = status.UploadResultsRendererMixin() |
---|
1680 | hunk ./src/allmydata/test/test_web.py 549 |
---|
1681 | - self.failUnlessEqual(urrm.render_time(None, None), "") |
---|
1682 | - self.failUnlessEqual(urrm.render_time(None, 2.5), "2.50s") |
---|
1683 | - self.failUnlessEqual(urrm.render_time(None, 0.25), "250ms") |
---|
1684 | - self.failUnlessEqual(urrm.render_time(None, 0.0021), "2.1ms") |
---|
1685 | - self.failUnlessEqual(urrm.render_time(None, 0.000123), "123us") |
---|
1686 | - self.failUnlessEqual(urrm.render_rate(None, None), "") |
---|
1687 | - self.failUnlessEqual(urrm.render_rate(None, 2500000), "2.50MBps") |
---|
1688 | - self.failUnlessEqual(urrm.render_rate(None, 30100), "30.1kBps") |
---|
1689 | - self.failUnlessEqual(urrm.render_rate(None, 123), "123Bps") |
---|
1690 | + self.failUnlessReallyEqual(urrm.render_time(None, None), "") |
---|
1691 | + self.failUnlessReallyEqual(urrm.render_time(None, 2.5), "2.50s") |
---|
1692 | + self.failUnlessReallyEqual(urrm.render_time(None, 0.25), "250ms") |
---|
1693 | + self.failUnlessReallyEqual(urrm.render_time(None, 0.0021), "2.1ms") |
---|
1694 | + self.failUnlessReallyEqual(urrm.render_time(None, 0.000123), "123us") |
---|
1695 | + self.failUnlessReallyEqual(urrm.render_rate(None, None), "") |
---|
1696 | + self.failUnlessReallyEqual(urrm.render_rate(None, 2500000), "2.50MBps") |
---|
1697 | + self.failUnlessReallyEqual(urrm.render_rate(None, 30100), "30.1kBps") |
---|
1698 | + self.failUnlessReallyEqual(urrm.render_rate(None, 123), "123Bps") |
---|
1699 | |
---|
1700 | def test_GET_FILEURL(self): |
---|
1701 | d = self.GET(self.public_url + "/foo/bar.txt") |
---|
1702 | hunk ./src/allmydata/test/test_web.py 569 |
---|
1703 | d = self.GET(self.public_url + "/foo/bar.txt", headers=headers, |
---|
1704 | return_response=True) |
---|
1705 | def _got((res, status, headers)): |
---|
1706 | - self.failUnlessEqual(int(status), 206) |
---|
1707 | + self.failUnlessReallyEqual(int(status), 206) |
---|
1708 | self.failUnless(headers.has_key("content-range")) |
---|
1709 | hunk ./src/allmydata/test/test_web.py 571 |
---|
1710 | - self.failUnlessEqual(headers["content-range"][0], |
---|
1711 | - "bytes 1-10/%d" % len(self.BAR_CONTENTS)) |
---|
1712 | - self.failUnlessEqual(res, self.BAR_CONTENTS[1:11]) |
---|
1713 | + self.failUnlessReallyEqual(headers["content-range"][0], |
---|
1714 | + "bytes 1-10/%d" % len(self.BAR_CONTENTS)) |
---|
1715 | + self.failUnlessReallyEqual(res, self.BAR_CONTENTS[1:11]) |
---|
1716 | d.addCallback(_got) |
---|
1717 | return d |
---|
1718 | |
---|
1719 | hunk ./src/allmydata/test/test_web.py 583 |
---|
1720 | d = self.GET(self.public_url + "/foo/bar.txt", headers=headers, |
---|
1721 | return_response=True) |
---|
1722 | def _got((res, status, headers)): |
---|
1723 | - self.failUnlessEqual(int(status), 206) |
---|
1724 | + self.failUnlessReallyEqual(int(status), 206) |
---|
1725 | self.failUnless(headers.has_key("content-range")) |
---|
1726 | hunk ./src/allmydata/test/test_web.py 585 |
---|
1727 | - self.failUnlessEqual(headers["content-range"][0], |
---|
1728 | - "bytes 5-%d/%d" % (length-1, length)) |
---|
1729 | - self.failUnlessEqual(res, self.BAR_CONTENTS[5:]) |
---|
1730 | + self.failUnlessReallyEqual(headers["content-range"][0], |
---|
1731 | + "bytes 5-%d/%d" % (length-1, length)) |
---|
1732 | + self.failUnlessReallyEqual(res, self.BAR_CONTENTS[5:]) |
---|
1733 | d.addCallback(_got) |
---|
1734 | return d |
---|
1735 | |
---|
1736 | hunk ./src/allmydata/test/test_web.py 597 |
---|
1737 | d = self.GET(self.public_url + "/foo/bar.txt", headers=headers, |
---|
1738 | return_response=True) |
---|
1739 | def _got((res, status, headers)): |
---|
1740 | - self.failUnlessEqual(int(status), 206) |
---|
1741 | + self.failUnlessReallyEqual(int(status), 206) |
---|
1742 | self.failUnless(headers.has_key("content-range")) |
---|
1743 | hunk ./src/allmydata/test/test_web.py 599 |
---|
1744 | - self.failUnlessEqual(headers["content-range"][0], |
---|
1745 | - "bytes %d-%d/%d" % (length-5, length-1, length)) |
---|
1746 | - self.failUnlessEqual(res, self.BAR_CONTENTS[-5:]) |
---|
1747 | + self.failUnlessReallyEqual(headers["content-range"][0], |
---|
1748 | + "bytes %d-%d/%d" % (length-5, length-1, length)) |
---|
1749 | + self.failUnlessReallyEqual(res, self.BAR_CONTENTS[-5:]) |
---|
1750 | d.addCallback(_got) |
---|
1751 | return d |
---|
1752 | |
---|
1753 | hunk ./src/allmydata/test/test_web.py 619 |
---|
1754 | d = self.HEAD(self.public_url + "/foo/bar.txt", headers=headers, |
---|
1755 | return_response=True) |
---|
1756 | def _got((res, status, headers)): |
---|
1757 | - self.failUnlessEqual(res, "") |
---|
1758 | - self.failUnlessEqual(int(status), 206) |
---|
1759 | + self.failUnlessReallyEqual(res, "") |
---|
1760 | + self.failUnlessReallyEqual(int(status), 206) |
---|
1761 | self.failUnless(headers.has_key("content-range")) |
---|
1762 | hunk ./src/allmydata/test/test_web.py 622 |
---|
1763 | - self.failUnlessEqual(headers["content-range"][0], |
---|
1764 | - "bytes 1-10/%d" % len(self.BAR_CONTENTS)) |
---|
1765 | + self.failUnlessReallyEqual(headers["content-range"][0], |
---|
1766 | + "bytes 1-10/%d" % len(self.BAR_CONTENTS)) |
---|
1767 | d.addCallback(_got) |
---|
1768 | return d |
---|
1769 | |
---|
1770 | hunk ./src/allmydata/test/test_web.py 633 |
---|
1771 | d = self.HEAD(self.public_url + "/foo/bar.txt", headers=headers, |
---|
1772 | return_response=True) |
---|
1773 | def _got((res, status, headers)): |
---|
1774 | - self.failUnlessEqual(int(status), 206) |
---|
1775 | + self.failUnlessReallyEqual(int(status), 206) |
---|
1776 | self.failUnless(headers.has_key("content-range")) |
---|
1777 | hunk ./src/allmydata/test/test_web.py 635 |
---|
1778 | - self.failUnlessEqual(headers["content-range"][0], |
---|
1779 | - "bytes 5-%d/%d" % (length-1, length)) |
---|
1780 | + self.failUnlessReallyEqual(headers["content-range"][0], |
---|
1781 | + "bytes 5-%d/%d" % (length-1, length)) |
---|
1782 | d.addCallback(_got) |
---|
1783 | return d |
---|
1784 | |
---|
1785 | hunk ./src/allmydata/test/test_web.py 646 |
---|
1786 | d = self.HEAD(self.public_url + "/foo/bar.txt", headers=headers, |
---|
1787 | return_response=True) |
---|
1788 | def _got((res, status, headers)): |
---|
1789 | - self.failUnlessEqual(int(status), 206) |
---|
1790 | + self.failUnlessReallyEqual(int(status), 206) |
---|
1791 | self.failUnless(headers.has_key("content-range")) |
---|
1792 | hunk ./src/allmydata/test/test_web.py 648 |
---|
1793 | - self.failUnlessEqual(headers["content-range"][0], |
---|
1794 | - "bytes %d-%d/%d" % (length-5, length-1, length)) |
---|
1795 | + self.failUnlessReallyEqual(headers["content-range"][0], |
---|
1796 | + "bytes %d-%d/%d" % (length-5, length-1, length)) |
---|
1797 | d.addCallback(_got) |
---|
1798 | return d |
---|
1799 | |
---|
1800 | hunk ./src/allmydata/test/test_web.py 667 |
---|
1801 | d = self.GET(self.public_url + "/foo/bar.txt", headers=headers, |
---|
1802 | return_response=True) |
---|
1803 | def _got((res, status, headers)): |
---|
1804 | - self.failUnlessEqual(int(status), 200) |
---|
1805 | + self.failUnlessReallyEqual(int(status), 200) |
---|
1806 | self.failUnless(not headers.has_key("content-range")) |
---|
1807 | hunk ./src/allmydata/test/test_web.py 669 |
---|
1808 | - self.failUnlessEqual(res, self.BAR_CONTENTS) |
---|
1809 | + self.failUnlessReallyEqual(res, self.BAR_CONTENTS) |
---|
1810 | d.addCallback(_got) |
---|
1811 | return d |
---|
1812 | |
---|
1813 | hunk ./src/allmydata/test/test_web.py 676 |
---|
1814 | def test_HEAD_FILEURL(self): |
---|
1815 | d = self.HEAD(self.public_url + "/foo/bar.txt", return_response=True) |
---|
1816 | def _got((res, status, headers)): |
---|
1817 | - self.failUnlessEqual(res, "") |
---|
1818 | - self.failUnlessEqual(headers["content-length"][0], |
---|
1819 | - str(len(self.BAR_CONTENTS))) |
---|
1820 | - self.failUnlessEqual(headers["content-type"], ["text/plain"]) |
---|
1821 | + self.failUnlessReallyEqual(res, "") |
---|
1822 | + self.failUnlessReallyEqual(headers["content-length"][0], |
---|
1823 | + str(len(self.BAR_CONTENTS))) |
---|
1824 | + self.failUnlessReallyEqual(headers["content-type"], ["text/plain"]) |
---|
1825 | d.addCallback(_got) |
---|
1826 | return d |
---|
1827 | |
---|
1828 | hunk ./src/allmydata/test/test_web.py 809 |
---|
1829 | def test_PUT_NEWFILEURL(self): |
---|
1830 | d = self.PUT(self.public_url + "/foo/new.txt", self.NEWFILE_CONTENTS) |
---|
1831 | # TODO: we lose the response code, so we can't check this |
---|
1832 | - #self.failUnlessEqual(responsecode, 201) |
---|
1833 | + #self.failUnlessReallyEqual(responsecode, 201) |
---|
1834 | d.addCallback(self.failUnlessURIMatchesROChild, self._foo_node, u"new.txt") |
---|
1835 | d.addCallback(lambda res: |
---|
1836 | self.failUnlessChildContentsAre(self._foo_node, u"new.txt", |
---|
1837 | hunk ./src/allmydata/test/test_web.py 820 |
---|
1838 | d = self.PUT(self.public_url + "/foo/new.txt?mutable=false", |
---|
1839 | self.NEWFILE_CONTENTS) |
---|
1840 | # TODO: we lose the response code, so we can't check this |
---|
1841 | - #self.failUnlessEqual(responsecode, 201) |
---|
1842 | + #self.failUnlessReallyEqual(responsecode, 201) |
---|
1843 | d.addCallback(self.failUnlessURIMatchesROChild, self._foo_node, u"new.txt") |
---|
1844 | d.addCallback(lambda res: |
---|
1845 | self.failUnlessChildContentsAre(self._foo_node, u"new.txt", |
---|
1846 | hunk ./src/allmydata/test/test_web.py 844 |
---|
1847 | d = self.PUT(self.public_url + "/foo/new.txt?mutable=true", |
---|
1848 | self.NEWFILE_CONTENTS) |
---|
1849 | # TODO: we lose the response code, so we can't check this |
---|
1850 | - #self.failUnlessEqual(responsecode, 201) |
---|
1851 | + #self.failUnlessReallyEqual(responsecode, 201) |
---|
1852 | def _check_uri(res): |
---|
1853 | u = uri.from_string_mutable_filenode(res) |
---|
1854 | self.failUnless(u.is_mutable()) |
---|
1855 | hunk ./src/allmydata/test/test_web.py 870 |
---|
1856 | def test_PUT_NEWFILEURL_replace(self): |
---|
1857 | d = self.PUT(self.public_url + "/foo/bar.txt", self.NEWFILE_CONTENTS) |
---|
1858 | # TODO: we lose the response code, so we can't check this |
---|
1859 | - #self.failUnlessEqual(responsecode, 200) |
---|
1860 | + #self.failUnlessReallyEqual(responsecode, 200) |
---|
1861 | d.addCallback(self.failUnlessURIMatchesROChild, self._foo_node, u"bar.txt") |
---|
1862 | d.addCallback(lambda res: |
---|
1863 | self.failUnlessChildContentsAre(self._foo_node, u"bar.txt", |
---|
1864 | hunk ./src/allmydata/test/test_web.py 943 |
---|
1865 | self.failUnlessIn("tahoe", data[1]["metadata"]) |
---|
1866 | self.failUnlessIn("linkcrtime", data[1]["metadata"]["tahoe"]) |
---|
1867 | self.failUnlessIn("linkmotime", data[1]["metadata"]["tahoe"]) |
---|
1868 | - self.failUnlessEqual(data[1]["metadata"]["tahoe"]["linkcrtime"], |
---|
1869 | - self._bar_txt_metadata["tahoe"]["linkcrtime"]) |
---|
1870 | + self.failUnlessReallyEqual(data[1]["metadata"]["tahoe"]["linkcrtime"], |
---|
1871 | + self._bar_txt_metadata["tahoe"]["linkcrtime"]) |
---|
1872 | |
---|
1873 | def test_GET_FILEURL_json(self): |
---|
1874 | # twisted.web.http.parse_qs ignores any query args without an '=', so |
---|
1875 | hunk ./src/allmydata/test/test_web.py 967 |
---|
1876 | def test_GET_FILEURL_uri(self): |
---|
1877 | d = self.GET(self.public_url + "/foo/bar.txt?t=uri") |
---|
1878 | def _check(res): |
---|
1879 | - self.failUnlessEqual(res, self._bar_txt_uri) |
---|
1880 | + self.failUnlessReallyEqual(res, self._bar_txt_uri) |
---|
1881 | d.addCallback(_check) |
---|
1882 | d.addCallback(lambda res: |
---|
1883 | self.GET(self.public_url + "/foo/bar.txt?t=readonly-uri")) |
---|
1884 | hunk ./src/allmydata/test/test_web.py 973 |
---|
1885 | def _check2(res): |
---|
1886 | # for now, for files, uris and readonly-uris are the same |
---|
1887 | - self.failUnlessEqual(res, self._bar_txt_uri) |
---|
1888 | + self.failUnlessReallyEqual(res, self._bar_txt_uri) |
---|
1889 | d.addCallback(_check2) |
---|
1890 | return d |
---|
1891 | |
---|
1892 | hunk ./src/allmydata/test/test_web.py 1135 |
---|
1893 | got = {} |
---|
1894 | for (path_list, cap) in data: |
---|
1895 | got[tuple(path_list)] = cap |
---|
1896 | - self.failUnlessEqual(got[(u"sub",)], self._sub_uri) |
---|
1897 | + self.failUnlessReallyEqual(got[(u"sub",)], self._sub_uri) |
---|
1898 | self.failUnless((u"sub",u"baz.txt") in got) |
---|
1899 | self.failUnless("finished" in res) |
---|
1900 | self.failUnless("origin" in res) |
---|
1901 | hunk ./src/allmydata/test/test_web.py 1159 |
---|
1902 | d.addCallback(self.wait_for_operation, "126") |
---|
1903 | d.addCallback(self.get_operation_results, "126", "json") |
---|
1904 | def _got_json(data): |
---|
1905 | - self.failUnlessEqual(data["finished"], True) |
---|
1906 | + self.failUnlessReallyEqual(data["finished"], True) |
---|
1907 | size = data["size"] |
---|
1908 | self.failUnless(size > 1000) |
---|
1909 | d.addCallback(_got_json) |
---|
1910 | hunk ./src/allmydata/test/test_web.py 1200 |
---|
1911 | "largest-immutable-file": 19, |
---|
1912 | } |
---|
1913 | for k,v in expected.iteritems(): |
---|
1914 | - self.failUnlessEqual(stats[k], v, |
---|
1915 | - "stats[%s] was %s, not %s" % |
---|
1916 | - (k, stats[k], v)) |
---|
1917 | - self.failUnlessEqual(stats["size-files-histogram"], |
---|
1918 | - [ [11, 31, 3] ]) |
---|
1919 | + self.failUnlessReallyEqual(stats[k], v, |
---|
1920 | + "stats[%s] was %s, not %s" % |
---|
1921 | + (k, stats[k], v)) |
---|
1922 | + self.failUnlessReallyEqual(stats["size-files-histogram"], |
---|
1923 | + [ [11, 31, 3] ]) |
---|
1924 | d.addCallback(_got_json) |
---|
1925 | return d |
---|
1926 | |
---|
1927 | hunk ./src/allmydata/test/test_web.py 1213 |
---|
1928 | def _check(res): |
---|
1929 | self.failUnless(res.endswith("\n")) |
---|
1930 | units = [simplejson.loads(t) for t in res[:-1].split("\n")] |
---|
1931 | - self.failUnlessEqual(len(units), 7) |
---|
1932 | - self.failUnlessEqual(units[-1]["type"], "stats") |
---|
1933 | + self.failUnlessReallyEqual(len(units), 7) |
---|
1934 | + self.failUnlessReallyEqual(units[-1]["type"], "stats") |
---|
1935 | first = units[0] |
---|
1936 | hunk ./src/allmydata/test/test_web.py 1216 |
---|
1937 | - self.failUnlessEqual(first["path"], []) |
---|
1938 | - self.failUnlessEqual(first["cap"], self._foo_uri) |
---|
1939 | - self.failUnlessEqual(first["type"], "directory") |
---|
1940 | + self.failUnlessReallyEqual(first["path"], []) |
---|
1941 | + self.failUnlessReallyEqual(first["cap"], self._foo_uri) |
---|
1942 | + self.failUnlessReallyEqual(first["type"], "directory") |
---|
1943 | baz = [u for u in units[:-1] if u["cap"] == self._baz_file_uri][0] |
---|
1944 | hunk ./src/allmydata/test/test_web.py 1220 |
---|
1945 | - self.failUnlessEqual(baz["path"], ["sub", "baz.txt"]) |
---|
1946 | + self.failUnlessReallyEqual(baz["path"], ["sub", "baz.txt"]) |
---|
1947 | self.failIfEqual(baz["storage-index"], None) |
---|
1948 | self.failIfEqual(baz["verifycap"], None) |
---|
1949 | self.failIfEqual(baz["repaircap"], None) |
---|
1950 | hunk ./src/allmydata/test/test_web.py 1231 |
---|
1951 | def test_GET_DIRURL_uri(self): |
---|
1952 | d = self.GET(self.public_url + "/foo?t=uri") |
---|
1953 | def _check(res): |
---|
1954 | - self.failUnlessEqual(res, self._foo_uri) |
---|
1955 | + self.failUnlessReallyEqual(res, self._foo_uri) |
---|
1956 | d.addCallback(_check) |
---|
1957 | return d |
---|
1958 | |
---|
1959 | hunk ./src/allmydata/test/test_web.py 1238 |
---|
1960 | def test_GET_DIRURL_readonly_uri(self): |
---|
1961 | d = self.GET(self.public_url + "/foo?t=readonly-uri") |
---|
1962 | def _check(res): |
---|
1963 | - self.failUnlessEqual(res, self._foo_readonly_uri) |
---|
1964 | + self.failUnlessReallyEqual(res, self._foo_readonly_uri) |
---|
1965 | d.addCallback(_check) |
---|
1966 | return d |
---|
1967 | |
---|
1968 | hunk ./src/allmydata/test/test_web.py 1390 |
---|
1969 | d = self.POST(url) |
---|
1970 | def made_subsub(ssuri): |
---|
1971 | d = self._foo_node.get_child_at_path(u"mkp/sub1/sub2") |
---|
1972 | - d.addCallback(lambda ssnode: self.failUnlessEqual(ssnode.get_uri(), ssuri)) |
---|
1973 | + d.addCallback(lambda ssnode: self.failUnlessReallyEqual(ssnode.get_uri(), ssuri)) |
---|
1974 | d = self.POST(url) |
---|
1975 | hunk ./src/allmydata/test/test_web.py 1392 |
---|
1976 | - d.addCallback(lambda uri2: self.failUnlessEqual(uri2, ssuri)) |
---|
1977 | + d.addCallback(lambda uri2: self.failUnlessReallyEqual(uri2, ssuri)) |
---|
1978 | return d |
---|
1979 | d.addCallback(made_subsub) |
---|
1980 | return d |
---|
1981 | hunk ./src/allmydata/test/test_web.py 1441 |
---|
1982 | assert isinstance(k, unicode) |
---|
1983 | d = node.list() |
---|
1984 | def _check(children): |
---|
1985 | - self.failUnlessEqual(sorted(children.keys()), sorted(expected_keys)) |
---|
1986 | + self.failUnlessReallyEqual(sorted(children.keys()), sorted(expected_keys)) |
---|
1987 | d.addCallback(_check) |
---|
1988 | return d |
---|
1989 | def failUnlessNodeHasChild(self, node, name): |
---|
1990 | hunk ./src/allmydata/test/test_web.py 1464 |
---|
1991 | d = node.get_child_at_path(name) |
---|
1992 | d.addCallback(lambda node: download_to_data(node)) |
---|
1993 | def _check(contents): |
---|
1994 | - self.failUnlessEqual(contents, expected_contents) |
---|
1995 | + self.failUnlessReallyEqual(contents, expected_contents) |
---|
1996 | d.addCallback(_check) |
---|
1997 | return d |
---|
1998 | |
---|
1999 | hunk ./src/allmydata/test/test_web.py 1473 |
---|
2000 | d = node.get_child_at_path(name) |
---|
2001 | d.addCallback(lambda node: node.download_best_version()) |
---|
2002 | def _check(contents): |
---|
2003 | - self.failUnlessEqual(contents, expected_contents) |
---|
2004 | + self.failUnlessReallyEqual(contents, expected_contents) |
---|
2005 | d.addCallback(_check) |
---|
2006 | return d |
---|
2007 | |
---|
2008 | hunk ./src/allmydata/test/test_web.py 1482 |
---|
2009 | d = node.get_child_at_path(name) |
---|
2010 | def _check(child): |
---|
2011 | self.failUnless(child.is_unknown() or not child.is_readonly()) |
---|
2012 | - self.failUnlessEqual(child.get_uri(), expected_uri.strip()) |
---|
2013 | - self.failUnlessEqual(child.get_write_uri(), expected_uri.strip()) |
---|
2014 | + self.failUnlessReallyEqual(child.get_uri(), expected_uri.strip()) |
---|
2015 | + self.failUnlessReallyEqual(child.get_write_uri(), expected_uri.strip()) |
---|
2016 | expected_ro_uri = self._make_readonly(expected_uri) |
---|
2017 | if expected_ro_uri: |
---|
2018 | hunk ./src/allmydata/test/test_web.py 1486 |
---|
2019 | - self.failUnlessEqual(child.get_readonly_uri(), expected_ro_uri.strip()) |
---|
2020 | + self.failUnlessReallyEqual(child.get_readonly_uri(), expected_ro_uri.strip()) |
---|
2021 | d.addCallback(_check) |
---|
2022 | return d |
---|
2023 | |
---|
2024 | hunk ./src/allmydata/test/test_web.py 1495 |
---|
2025 | d = node.get_child_at_path(name) |
---|
2026 | def _check(child): |
---|
2027 | self.failUnless(child.is_unknown() or child.is_readonly()) |
---|
2028 | - self.failUnlessEqual(child.get_write_uri(), None) |
---|
2029 | - self.failUnlessEqual(child.get_uri(), expected_uri.strip()) |
---|
2030 | - self.failUnlessEqual(child.get_readonly_uri(), expected_uri.strip()) |
---|
2031 | + self.failUnlessReallyEqual(child.get_write_uri(), None) |
---|
2032 | + self.failUnlessReallyEqual(child.get_uri(), expected_uri.strip()) |
---|
2033 | + self.failUnlessReallyEqual(child.get_readonly_uri(), expected_uri.strip()) |
---|
2034 | d.addCallback(_check) |
---|
2035 | return d |
---|
2036 | |
---|
2037 | hunk ./src/allmydata/test/test_web.py 1506 |
---|
2038 | d = node.get_child_at_path(name) |
---|
2039 | def _check(child): |
---|
2040 | self.failUnless(child.is_unknown() or not child.is_readonly()) |
---|
2041 | - self.failUnlessEqual(child.get_uri(), got_uri.strip()) |
---|
2042 | - self.failUnlessEqual(child.get_write_uri(), got_uri.strip()) |
---|
2043 | + self.failUnlessReallyEqual(child.get_uri(), got_uri.strip()) |
---|
2044 | + self.failUnlessReallyEqual(child.get_write_uri(), got_uri.strip()) |
---|
2045 | expected_ro_uri = self._make_readonly(got_uri) |
---|
2046 | if expected_ro_uri: |
---|
2047 | hunk ./src/allmydata/test/test_web.py 1510 |
---|
2048 | - self.failUnlessEqual(child.get_readonly_uri(), expected_ro_uri.strip()) |
---|
2049 | + self.failUnlessReallyEqual(child.get_readonly_uri(), expected_ro_uri.strip()) |
---|
2050 | d.addCallback(_check) |
---|
2051 | return d |
---|
2052 | |
---|
2053 | hunk ./src/allmydata/test/test_web.py 1519 |
---|
2054 | d = node.get_child_at_path(name) |
---|
2055 | def _check(child): |
---|
2056 | self.failUnless(child.is_unknown() or child.is_readonly()) |
---|
2057 | - self.failUnlessEqual(child.get_write_uri(), None) |
---|
2058 | - self.failUnlessEqual(got_uri.strip(), child.get_uri()) |
---|
2059 | - self.failUnlessEqual(got_uri.strip(), child.get_readonly_uri()) |
---|
2060 | + self.failUnlessReallyEqual(child.get_write_uri(), None) |
---|
2061 | + self.failUnlessReallyEqual(got_uri.strip(), child.get_uri()) |
---|
2062 | + self.failUnlessReallyEqual(got_uri.strip(), child.get_readonly_uri()) |
---|
2063 | d.addCallback(_check) |
---|
2064 | return d |
---|
2065 | |
---|
2066 | hunk ./src/allmydata/test/test_web.py 1549 |
---|
2067 | self.NEWFILE_CONTENTS)) |
---|
2068 | target_url = self.public_url + "/foo/" + filename.encode("utf-8") |
---|
2069 | d.addCallback(lambda res: self.GET(target_url)) |
---|
2070 | - d.addCallback(lambda contents: self.failUnlessEqual(contents, |
---|
2071 | - self.NEWFILE_CONTENTS, |
---|
2072 | - contents)) |
---|
2073 | + d.addCallback(lambda contents: self.failUnlessReallyEqual(contents, |
---|
2074 | + self.NEWFILE_CONTENTS, |
---|
2075 | + contents)) |
---|
2076 | return d |
---|
2077 | |
---|
2078 | def test_POST_upload_unicode_named(self): |
---|
2079 | hunk ./src/allmydata/test/test_web.py 1566 |
---|
2080 | self.NEWFILE_CONTENTS)) |
---|
2081 | target_url = self.public_url + "/foo/" + filename.encode("utf-8") |
---|
2082 | d.addCallback(lambda res: self.GET(target_url)) |
---|
2083 | - d.addCallback(lambda contents: self.failUnlessEqual(contents, |
---|
2084 | - self.NEWFILE_CONTENTS, |
---|
2085 | - contents)) |
---|
2086 | + d.addCallback(lambda contents: self.failUnlessReallyEqual(contents, |
---|
2087 | + self.NEWFILE_CONTENTS, |
---|
2088 | + contents)) |
---|
2089 | return d |
---|
2090 | |
---|
2091 | def test_POST_upload_no_link(self): |
---|
2092 | hunk ./src/allmydata/test/test_web.py 1609 |
---|
2093 | |
---|
2094 | def test_POST_upload_no_link_whendone_results(self): |
---|
2095 | def check(statuscode, target): |
---|
2096 | - self.failUnlessEqual(statuscode, str(http.FOUND)) |
---|
2097 | + self.failUnlessReallyEqual(statuscode, str(http.FOUND)) |
---|
2098 | self.failUnless(target.startswith(self.webish_url), target) |
---|
2099 | return client.getPage(target, method="GET") |
---|
2100 | d = self.shouldRedirect2("test_POST_upload_no_link_whendone_results", |
---|
2101 | hunk ./src/allmydata/test/test_web.py 1618 |
---|
2102 | when_done="/uri/%(uri)s", |
---|
2103 | file=("new.txt", self.NEWFILE_CONTENTS)) |
---|
2104 | d.addCallback(lambda res: |
---|
2105 | - self.failUnlessEqual(res, self.NEWFILE_CONTENTS)) |
---|
2106 | + self.failUnlessReallyEqual(res, self.NEWFILE_CONTENTS)) |
---|
2107 | return d |
---|
2108 | |
---|
2109 | def test_POST_upload_no_link_mutable(self): |
---|
2110 | hunk ./src/allmydata/test/test_web.py 1634 |
---|
2111 | return n.download_best_version() |
---|
2112 | d.addCallback(_check) |
---|
2113 | def _check2(data): |
---|
2114 | - self.failUnlessEqual(data, self.NEWFILE_CONTENTS) |
---|
2115 | + self.failUnlessReallyEqual(data, self.NEWFILE_CONTENTS) |
---|
2116 | return self.GET("/uri/%s" % urllib.quote(self.filecap)) |
---|
2117 | d.addCallback(_check2) |
---|
2118 | def _check3(data): |
---|
2119 | hunk ./src/allmydata/test/test_web.py 1638 |
---|
2120 | - self.failUnlessEqual(data, self.NEWFILE_CONTENTS) |
---|
2121 | + self.failUnlessReallyEqual(data, self.NEWFILE_CONTENTS) |
---|
2122 | return self.GET("/file/%s" % urllib.quote(self.filecap)) |
---|
2123 | d.addCallback(_check3) |
---|
2124 | def _check4(data): |
---|
2125 | hunk ./src/allmydata/test/test_web.py 1642 |
---|
2126 | - self.failUnlessEqual(data, self.NEWFILE_CONTENTS) |
---|
2127 | + self.failUnlessReallyEqual(data, self.NEWFILE_CONTENTS) |
---|
2128 | d.addCallback(_check4) |
---|
2129 | return d |
---|
2130 | |
---|
2131 | hunk ./src/allmydata/test/test_web.py 1690 |
---|
2132 | self.failUnless(IMutableFileNode.providedBy(newnode)) |
---|
2133 | self.failUnless(newnode.is_mutable()) |
---|
2134 | self.failIf(newnode.is_readonly()) |
---|
2135 | - self.failUnlessEqual(self._mutable_uri, newnode.get_uri()) |
---|
2136 | + self.failUnlessReallyEqual(self._mutable_uri, newnode.get_uri()) |
---|
2137 | d.addCallback(_got2) |
---|
2138 | |
---|
2139 | # upload a second time, using PUT instead of POST |
---|
2140 | hunk ./src/allmydata/test/test_web.py 1719 |
---|
2141 | self.failUnless(IMutableFileNode.providedBy(newnode)) |
---|
2142 | self.failUnless(newnode.is_mutable()) |
---|
2143 | self.failIf(newnode.is_readonly()) |
---|
2144 | - self.failUnlessEqual(self._mutable_uri, newnode.get_uri()) |
---|
2145 | + self.failUnlessReallyEqual(self._mutable_uri, newnode.get_uri()) |
---|
2146 | d.addCallback(_got3) |
---|
2147 | |
---|
2148 | # look at the JSON form of the enclosing directory |
---|
2149 | hunk ./src/allmydata/test/test_web.py 1728 |
---|
2150 | followRedirect=True)) |
---|
2151 | def _check_page_json(res): |
---|
2152 | parsed = simplejson.loads(res) |
---|
2153 | - self.failUnlessEqual(parsed[0], "dirnode") |
---|
2154 | + self.failUnlessReallyEqual(parsed[0], "dirnode") |
---|
2155 | children = dict( [(unicode(name),value) |
---|
2156 | for (name,value) |
---|
2157 | in parsed[1]["children"].iteritems()] ) |
---|
2158 | hunk ./src/allmydata/test/test_web.py 1734 |
---|
2159 | self.failUnless("new.txt" in children) |
---|
2160 | new_json = children["new.txt"] |
---|
2161 | - self.failUnlessEqual(new_json[0], "filenode") |
---|
2162 | + self.failUnlessReallyEqual(new_json[0], "filenode") |
---|
2163 | self.failUnless(new_json[1]["mutable"]) |
---|
2164 | hunk ./src/allmydata/test/test_web.py 1736 |
---|
2165 | - self.failUnlessEqual(new_json[1]["rw_uri"], self._mutable_uri) |
---|
2166 | - ro_uri = unicode(self._mutable_node.get_readonly().to_string()) |
---|
2167 | - self.failUnlessEqual(new_json[1]["ro_uri"], ro_uri) |
---|
2168 | + self.failUnlessReallyEqual(new_json[1]["rw_uri"], self._mutable_uri) |
---|
2169 | + ro_uri = self._mutable_node.get_readonly().to_string() |
---|
2170 | + self.failUnlessReallyEqual(new_json[1]["ro_uri"], ro_uri) |
---|
2171 | d.addCallback(_check_page_json) |
---|
2172 | |
---|
2173 | # and the JSON form of the file |
---|
2174 | hunk ./src/allmydata/test/test_web.py 1746 |
---|
2175 | self.GET(self.public_url + "/foo/new.txt?t=json")) |
---|
2176 | def _check_file_json(res): |
---|
2177 | parsed = simplejson.loads(res) |
---|
2178 | - self.failUnlessEqual(parsed[0], "filenode") |
---|
2179 | + self.failUnlessReallyEqual(parsed[0], "filenode") |
---|
2180 | self.failUnless(parsed[1]["mutable"]) |
---|
2181 | hunk ./src/allmydata/test/test_web.py 1748 |
---|
2182 | - self.failUnlessEqual(parsed[1]["rw_uri"], self._mutable_uri) |
---|
2183 | - ro_uri = unicode(self._mutable_node.get_readonly().to_string()) |
---|
2184 | - self.failUnlessEqual(parsed[1]["ro_uri"], ro_uri) |
---|
2185 | + self.failUnlessReallyEqual(parsed[1]["rw_uri"], self._mutable_uri) |
---|
2186 | + ro_uri = self._mutable_node.get_readonly().to_string() |
---|
2187 | + self.failUnlessReallyEqual(parsed[1]["ro_uri"], ro_uri) |
---|
2188 | d.addCallback(_check_file_json) |
---|
2189 | |
---|
2190 | # and look at t=uri and t=readonly-uri |
---|
2191 | hunk ./src/allmydata/test/test_web.py 1756 |
---|
2192 | d.addCallback(lambda res: |
---|
2193 | self.GET(self.public_url + "/foo/new.txt?t=uri")) |
---|
2194 | - d.addCallback(lambda res: self.failUnlessEqual(res, self._mutable_uri)) |
---|
2195 | + d.addCallback(lambda res: self.failUnlessReallyEqual(res, self._mutable_uri)) |
---|
2196 | d.addCallback(lambda res: |
---|
2197 | self.GET(self.public_url + "/foo/new.txt?t=readonly-uri")) |
---|
2198 | def _check_ro_uri(res): |
---|
2199 | hunk ./src/allmydata/test/test_web.py 1760 |
---|
2200 | - ro_uri = unicode(self._mutable_node.get_readonly().to_string()) |
---|
2201 | - self.failUnlessEqual(res, ro_uri) |
---|
2202 | + ro_uri = self._mutable_node.get_readonly().to_string() |
---|
2203 | + self.failUnlessReallyEqual(res, ro_uri) |
---|
2204 | d.addCallback(_check_ro_uri) |
---|
2205 | |
---|
2206 | # make sure we can get to it from /uri/URI |
---|
2207 | hunk ./src/allmydata/test/test_web.py 1768 |
---|
2208 | d.addCallback(lambda res: |
---|
2209 | self.GET("/uri/%s" % urllib.quote(self._mutable_uri))) |
---|
2210 | d.addCallback(lambda res: |
---|
2211 | - self.failUnlessEqual(res, NEW2_CONTENTS)) |
---|
2212 | + self.failUnlessReallyEqual(res, NEW2_CONTENTS)) |
---|
2213 | |
---|
2214 | # and that HEAD computes the size correctly |
---|
2215 | d.addCallback(lambda res: |
---|
2216 | hunk ./src/allmydata/test/test_web.py 1775 |
---|
2217 | self.HEAD(self.public_url + "/foo/new.txt", |
---|
2218 | return_response=True)) |
---|
2219 | def _got_headers((res, status, headers)): |
---|
2220 | - self.failUnlessEqual(res, "") |
---|
2221 | - self.failUnlessEqual(headers["content-length"][0], |
---|
2222 | - str(len(NEW2_CONTENTS))) |
---|
2223 | - self.failUnlessEqual(headers["content-type"], ["text/plain"]) |
---|
2224 | + self.failUnlessReallyEqual(res, "") |
---|
2225 | + self.failUnlessReallyEqual(headers["content-length"][0], |
---|
2226 | + str(len(NEW2_CONTENTS))) |
---|
2227 | + self.failUnlessReallyEqual(headers["content-type"], ["text/plain"]) |
---|
2228 | d.addCallback(_got_headers) |
---|
2229 | |
---|
2230 | # make sure that size errors are displayed correctly for overwrite |
---|
2231 | hunk ./src/allmydata/test/test_web.py 1836 |
---|
2232 | d = self.POST(self.public_url + "/foo?replace=false", t="upload", |
---|
2233 | file=("new.txt", self.NEWFILE_CONTENTS)) |
---|
2234 | d.addCallback(lambda res: self.GET(self.public_url + "/foo/new.txt")) |
---|
2235 | - d.addCallback(lambda res: self.failUnlessEqual(res, |
---|
2236 | - self.NEWFILE_CONTENTS)) |
---|
2237 | + d.addCallback(lambda res: self.failUnlessReallyEqual(res, |
---|
2238 | + self.NEWFILE_CONTENTS)) |
---|
2239 | return d |
---|
2240 | |
---|
2241 | def test_POST_upload_no_replace_queryarg(self): |
---|
2242 | hunk ./src/allmydata/test/test_web.py 1907 |
---|
2243 | d.addCallback(_check) |
---|
2244 | redir_url = "http://allmydata.org/TARGET" |
---|
2245 | def _check2(statuscode, target): |
---|
2246 | - self.failUnlessEqual(statuscode, str(http.FOUND)) |
---|
2247 | - self.failUnlessEqual(target, redir_url) |
---|
2248 | + self.failUnlessReallyEqual(statuscode, str(http.FOUND)) |
---|
2249 | + self.failUnlessReallyEqual(target, redir_url) |
---|
2250 | d.addCallback(lambda res: |
---|
2251 | self.shouldRedirect2("test_POST_FILEURL_check", |
---|
2252 | _check2, |
---|
2253 | hunk ./src/allmydata/test/test_web.py 1941 |
---|
2254 | d.addCallback(_check) |
---|
2255 | redir_url = "http://allmydata.org/TARGET" |
---|
2256 | def _check2(statuscode, target): |
---|
2257 | - self.failUnlessEqual(statuscode, str(http.FOUND)) |
---|
2258 | - self.failUnlessEqual(target, redir_url) |
---|
2259 | + self.failUnlessReallyEqual(statuscode, str(http.FOUND)) |
---|
2260 | + self.failUnlessReallyEqual(target, redir_url) |
---|
2261 | d.addCallback(lambda res: |
---|
2262 | self.shouldRedirect2("test_POST_FILEURL_check_and_repair", |
---|
2263 | _check2, |
---|
2264 | hunk ./src/allmydata/test/test_web.py 1966 |
---|
2265 | d.addCallback(_check) |
---|
2266 | redir_url = "http://allmydata.org/TARGET" |
---|
2267 | def _check2(statuscode, target): |
---|
2268 | - self.failUnlessEqual(statuscode, str(http.FOUND)) |
---|
2269 | - self.failUnlessEqual(target, redir_url) |
---|
2270 | + self.failUnlessReallyEqual(statuscode, str(http.FOUND)) |
---|
2271 | + self.failUnlessReallyEqual(target, redir_url) |
---|
2272 | d.addCallback(lambda res: |
---|
2273 | self.shouldRedirect2("test_POST_DIRURL_check", |
---|
2274 | _check2, |
---|
2275 | hunk ./src/allmydata/test/test_web.py 2000 |
---|
2276 | d.addCallback(_check) |
---|
2277 | redir_url = "http://allmydata.org/TARGET" |
---|
2278 | def _check2(statuscode, target): |
---|
2279 | - self.failUnlessEqual(statuscode, str(http.FOUND)) |
---|
2280 | - self.failUnlessEqual(target, redir_url) |
---|
2281 | + self.failUnlessReallyEqual(statuscode, str(http.FOUND)) |
---|
2282 | + self.failUnlessReallyEqual(target, redir_url) |
---|
2283 | d.addCallback(lambda res: |
---|
2284 | self.shouldRedirect2("test_POST_DIRURL_check_and_repair", |
---|
2285 | _check2, |
---|
2286 | hunk ./src/allmydata/test/test_web.py 2054 |
---|
2287 | |
---|
2288 | def test_POST_DIRURL_deepcheck(self): |
---|
2289 | def _check_redirect(statuscode, target): |
---|
2290 | - self.failUnlessEqual(statuscode, str(http.FOUND)) |
---|
2291 | + self.failUnlessReallyEqual(statuscode, str(http.FOUND)) |
---|
2292 | self.failUnless(target.endswith("/operations/123")) |
---|
2293 | d = self.shouldRedirect2("test_POST_DIRURL_deepcheck", _check_redirect, |
---|
2294 | self.POST, self.public_url, |
---|
2295 | hunk ./src/allmydata/test/test_web.py 2061 |
---|
2296 | t="start-deep-check", ophandle="123") |
---|
2297 | d.addCallback(self.wait_for_operation, "123") |
---|
2298 | def _check_json(data): |
---|
2299 | - self.failUnlessEqual(data["finished"], True) |
---|
2300 | - self.failUnlessEqual(data["count-objects-checked"], 8) |
---|
2301 | - self.failUnlessEqual(data["count-objects-healthy"], 8) |
---|
2302 | + self.failUnlessReallyEqual(data["finished"], True) |
---|
2303 | + self.failUnlessReallyEqual(data["count-objects-checked"], 8) |
---|
2304 | + self.failUnlessReallyEqual(data["count-objects-healthy"], 8) |
---|
2305 | d.addCallback(_check_json) |
---|
2306 | d.addCallback(self.get_operation_results, "123", "html") |
---|
2307 | def _check_html(res): |
---|
2308 | hunk ./src/allmydata/test/test_web.py 2086 |
---|
2309 | self.GET("/operations/123/%s?output=JSON" % foo_si_s)) |
---|
2310 | def _check_foo_json(res): |
---|
2311 | data = simplejson.loads(res) |
---|
2312 | - self.failUnlessEqual(data["storage-index"], foo_si_s) |
---|
2313 | + self.failUnlessReallyEqual(data["storage-index"], foo_si_s) |
---|
2314 | self.failUnless(data["results"]["healthy"]) |
---|
2315 | d.addCallback(_check_foo_json) |
---|
2316 | return d |
---|
2317 | hunk ./src/allmydata/test/test_web.py 2096 |
---|
2318 | ophandle="124", output="json", followRedirect=True) |
---|
2319 | d.addCallback(self.wait_for_operation, "124") |
---|
2320 | def _check_json(data): |
---|
2321 | - self.failUnlessEqual(data["finished"], True) |
---|
2322 | - self.failUnlessEqual(data["count-objects-checked"], 8) |
---|
2323 | - self.failUnlessEqual(data["count-objects-healthy-pre-repair"], 8) |
---|
2324 | - self.failUnlessEqual(data["count-objects-unhealthy-pre-repair"], 0) |
---|
2325 | - self.failUnlessEqual(data["count-corrupt-shares-pre-repair"], 0) |
---|
2326 | - self.failUnlessEqual(data["count-repairs-attempted"], 0) |
---|
2327 | - self.failUnlessEqual(data["count-repairs-successful"], 0) |
---|
2328 | - self.failUnlessEqual(data["count-repairs-unsuccessful"], 0) |
---|
2329 | - self.failUnlessEqual(data["count-objects-healthy-post-repair"], 8) |
---|
2330 | - self.failUnlessEqual(data["count-objects-unhealthy-post-repair"], 0) |
---|
2331 | - self.failUnlessEqual(data["count-corrupt-shares-post-repair"], 0) |
---|
2332 | + self.failUnlessReallyEqual(data["finished"], True) |
---|
2333 | + self.failUnlessReallyEqual(data["count-objects-checked"], 8) |
---|
2334 | + self.failUnlessReallyEqual(data["count-objects-healthy-pre-repair"], 8) |
---|
2335 | + self.failUnlessReallyEqual(data["count-objects-unhealthy-pre-repair"], 0) |
---|
2336 | + self.failUnlessReallyEqual(data["count-corrupt-shares-pre-repair"], 0) |
---|
2337 | + self.failUnlessReallyEqual(data["count-repairs-attempted"], 0) |
---|
2338 | + self.failUnlessReallyEqual(data["count-repairs-successful"], 0) |
---|
2339 | + self.failUnlessReallyEqual(data["count-repairs-unsuccessful"], 0) |
---|
2340 | + self.failUnlessReallyEqual(data["count-objects-healthy-post-repair"], 8) |
---|
2341 | + self.failUnlessReallyEqual(data["count-objects-unhealthy-post-repair"], 0) |
---|
2342 | + self.failUnlessReallyEqual(data["count-corrupt-shares-post-repair"], 0) |
---|
2343 | d.addCallback(_check_json) |
---|
2344 | d.addCallback(self.get_operation_results, "124", "html") |
---|
2345 | def _check_html(res): |
---|
2346 | hunk ./src/allmydata/test/test_web.py 2641 |
---|
2347 | |
---|
2348 | def failUnlessIsEmptyJSON(self, res): |
---|
2349 | data = simplejson.loads(res) |
---|
2350 | - self.failUnlessEqual(data[0], "dirnode", data) |
---|
2351 | - self.failUnlessEqual(len(data[1]["children"]), 0) |
---|
2352 | + self.failUnlessReallyEqual(data[0], "dirnode", data) |
---|
2353 | + self.failUnlessReallyEqual(len(data[1]["children"]), 0) |
---|
2354 | |
---|
2355 | def test_POST_rename_file_slash_fail(self): |
---|
2356 | d = self.POST(self.public_url + "/foo", t="rename", |
---|
2357 | hunk ./src/allmydata/test/test_web.py 2677 |
---|
2358 | " actual page: %s" % (which, to_where, res)) |
---|
2359 | res.trap(error.PageRedirect) |
---|
2360 | if statuscode is not None: |
---|
2361 | - self.failUnlessEqual(res.value.status, statuscode, |
---|
2362 | - "%s: not a redirect" % which) |
---|
2363 | + self.failUnlessReallyEqual(res.value.status, statuscode, |
---|
2364 | + "%s: not a redirect" % which) |
---|
2365 | if target is not None: |
---|
2366 | # the PageRedirect does not seem to capture the uri= query arg |
---|
2367 | # properly, so we can't check for it. |
---|
2368 | hunk ./src/allmydata/test/test_web.py 2683 |
---|
2369 | realtarget = self.webish_url + target |
---|
2370 | - self.failUnlessEqual(res.value.location, realtarget, |
---|
2371 | - "%s: wrong target" % which) |
---|
2372 | + self.failUnlessReallyEqual(res.value.location, realtarget, |
---|
2373 | + "%s: wrong target" % which) |
---|
2374 | return res.value.location |
---|
2375 | |
---|
2376 | def test_GET_URI_form(self): |
---|
2377 | hunk ./src/allmydata/test/test_web.py 2762 |
---|
2378 | # replace /foo with a new (empty) directory |
---|
2379 | d = self.PUT(self.public_url + "/foo?t=uri", new_uri) |
---|
2380 | d.addCallback(lambda res: |
---|
2381 | - self.failUnlessEqual(res.strip(), new_uri)) |
---|
2382 | + self.failUnlessReallyEqual(res.strip(), new_uri)) |
---|
2383 | d.addCallback(lambda res: |
---|
2384 | self.failUnlessRWChildURIIs(self.public_root, |
---|
2385 | u"foo", |
---|
2386 | hunk ./src/allmydata/test/test_web.py 2803 |
---|
2387 | def test_PUT_NEWFILEURL_uri(self): |
---|
2388 | contents, n, new_uri = self.makefile(8) |
---|
2389 | d = self.PUT(self.public_url + "/foo/new.txt?t=uri", new_uri) |
---|
2390 | - d.addCallback(lambda res: self.failUnlessEqual(res.strip(), new_uri)) |
---|
2391 | + d.addCallback(lambda res: self.failUnlessReallyEqual(res.strip(), new_uri)) |
---|
2392 | d.addCallback(lambda res: |
---|
2393 | self.failUnlessChildContentsAre(self._foo_node, u"new.txt", |
---|
2394 | contents)) |
---|
2395 | hunk ./src/allmydata/test/test_web.py 2812 |
---|
2396 | def test_PUT_NEWFILEURL_uri_replace(self): |
---|
2397 | contents, n, new_uri = self.makefile(8) |
---|
2398 | d = self.PUT(self.public_url + "/foo/bar.txt?t=uri", new_uri) |
---|
2399 | - d.addCallback(lambda res: self.failUnlessEqual(res.strip(), new_uri)) |
---|
2400 | + d.addCallback(lambda res: self.failUnlessReallyEqual(res.strip(), new_uri)) |
---|
2401 | d.addCallback(lambda res: |
---|
2402 | self.failUnlessChildContentsAre(self._foo_node, u"bar.txt", |
---|
2403 | contents)) |
---|
2404 | hunk ./src/allmydata/test/test_web.py 2853 |
---|
2405 | def _check(uri): |
---|
2406 | assert isinstance(uri, str), uri |
---|
2407 | self.failUnless(uri in FakeCHKFileNode.all_contents) |
---|
2408 | - self.failUnlessEqual(FakeCHKFileNode.all_contents[uri], |
---|
2409 | - file_contents) |
---|
2410 | + self.failUnlessReallyEqual(FakeCHKFileNode.all_contents[uri], |
---|
2411 | + file_contents) |
---|
2412 | return self.GET("/uri/%s" % uri) |
---|
2413 | d.addCallback(_check) |
---|
2414 | def _check2(res): |
---|
2415 | hunk ./src/allmydata/test/test_web.py 2858 |
---|
2416 | - self.failUnlessEqual(res, file_contents) |
---|
2417 | + self.failUnlessReallyEqual(res, file_contents) |
---|
2418 | d.addCallback(_check2) |
---|
2419 | return d |
---|
2420 | |
---|
2421 | hunk ./src/allmydata/test/test_web.py 2868 |
---|
2422 | def _check(uri): |
---|
2423 | assert isinstance(uri, str), uri |
---|
2424 | self.failUnless(uri in FakeCHKFileNode.all_contents) |
---|
2425 | - self.failUnlessEqual(FakeCHKFileNode.all_contents[uri], |
---|
2426 | - file_contents) |
---|
2427 | + self.failUnlessReallyEqual(FakeCHKFileNode.all_contents[uri], |
---|
2428 | + file_contents) |
---|
2429 | return self.GET("/uri/%s" % uri) |
---|
2430 | d.addCallback(_check) |
---|
2431 | def _check2(res): |
---|
2432 | hunk ./src/allmydata/test/test_web.py 2873 |
---|
2433 | - self.failUnlessEqual(res, file_contents) |
---|
2434 | + self.failUnlessReallyEqual(res, file_contents) |
---|
2435 | d.addCallback(_check2) |
---|
2436 | return d |
---|
2437 | |
---|
2438 | hunk ./src/allmydata/test/test_web.py 2898 |
---|
2439 | return n.download_best_version() |
---|
2440 | d.addCallback(_check1) |
---|
2441 | def _check2(data): |
---|
2442 | - self.failUnlessEqual(data, file_contents) |
---|
2443 | + self.failUnlessReallyEqual(data, file_contents) |
---|
2444 | return self.GET("/uri/%s" % urllib.quote(self.filecap)) |
---|
2445 | d.addCallback(_check2) |
---|
2446 | def _check3(res): |
---|
2447 | hunk ./src/allmydata/test/test_web.py 2902 |
---|
2448 | - self.failUnlessEqual(res, file_contents) |
---|
2449 | + self.failUnlessReallyEqual(res, file_contents) |
---|
2450 | d.addCallback(_check3) |
---|
2451 | return d |
---|
2452 | |
---|
2453 | hunk ./src/allmydata/test/test_web.py 3105 |
---|
2454 | |
---|
2455 | d = self.GET("/static/subdir/hello.txt") |
---|
2456 | def _check(res): |
---|
2457 | - self.failUnlessEqual(res, "hello") |
---|
2458 | + self.failUnlessReallyEqual(res, "hello") |
---|
2459 | d.addCallback(_check) |
---|
2460 | return d |
---|
2461 | |
---|
2462 | hunk ./src/allmydata/test/test_web.py 3110 |
---|
2463 | |
---|
2464 | -class Util(unittest.TestCase, ShouldFailMixin): |
---|
2465 | +class Util(ShouldFailMixin, testutil.ReallyEqualMixin, unittest.TestCase): |
---|
2466 | def test_load_file(self): |
---|
2467 | # This will raise an exception unless a well-formed XML file is found under that name. |
---|
2468 | common.getxmlfile('directory.xhtml').load() |
---|
2469 | hunk ./src/allmydata/test/test_web.py 3116 |
---|
2470 | |
---|
2471 | def test_parse_replace_arg(self): |
---|
2472 | - self.failUnlessEqual(common.parse_replace_arg("true"), True) |
---|
2473 | - self.failUnlessEqual(common.parse_replace_arg("false"), False) |
---|
2474 | - self.failUnlessEqual(common.parse_replace_arg("only-files"), |
---|
2475 | - "only-files") |
---|
2476 | + self.failUnlessReallyEqual(common.parse_replace_arg("true"), True) |
---|
2477 | + self.failUnlessReallyEqual(common.parse_replace_arg("false"), False) |
---|
2478 | + self.failUnlessReallyEqual(common.parse_replace_arg("only-files"), |
---|
2479 | + "only-files") |
---|
2480 | self.shouldFail(AssertionError, "test_parse_replace_arg", "", |
---|
2481 | common.parse_replace_arg, "only_fles") |
---|
2482 | |
---|
2483 | hunk ./src/allmydata/test/test_web.py 3124 |
---|
2484 | def test_abbreviate_time(self): |
---|
2485 | - self.failUnlessEqual(common.abbreviate_time(None), "") |
---|
2486 | - self.failUnlessEqual(common.abbreviate_time(1.234), "1.23s") |
---|
2487 | - self.failUnlessEqual(common.abbreviate_time(0.123), "123ms") |
---|
2488 | - self.failUnlessEqual(common.abbreviate_time(0.00123), "1.2ms") |
---|
2489 | - self.failUnlessEqual(common.abbreviate_time(0.000123), "123us") |
---|
2490 | + self.failUnlessReallyEqual(common.abbreviate_time(None), "") |
---|
2491 | + self.failUnlessReallyEqual(common.abbreviate_time(1.234), "1.23s") |
---|
2492 | + self.failUnlessReallyEqual(common.abbreviate_time(0.123), "123ms") |
---|
2493 | + self.failUnlessReallyEqual(common.abbreviate_time(0.00123), "1.2ms") |
---|
2494 | + self.failUnlessReallyEqual(common.abbreviate_time(0.000123), "123us") |
---|
2495 | |
---|
2496 | def test_abbreviate_rate(self): |
---|
2497 | hunk ./src/allmydata/test/test_web.py 3131 |
---|
2498 | - self.failUnlessEqual(common.abbreviate_rate(None), "") |
---|
2499 | - self.failUnlessEqual(common.abbreviate_rate(1234000), "1.23MBps") |
---|
2500 | - self.failUnlessEqual(common.abbreviate_rate(12340), "12.3kBps") |
---|
2501 | - self.failUnlessEqual(common.abbreviate_rate(123), "123Bps") |
---|
2502 | + self.failUnlessReallyEqual(common.abbreviate_rate(None), "") |
---|
2503 | + self.failUnlessReallyEqual(common.abbreviate_rate(1234000), "1.23MBps") |
---|
2504 | + self.failUnlessReallyEqual(common.abbreviate_rate(12340), "12.3kBps") |
---|
2505 | + self.failUnlessReallyEqual(common.abbreviate_rate(123), "123Bps") |
---|
2506 | |
---|
2507 | def test_abbreviate_size(self): |
---|
2508 | hunk ./src/allmydata/test/test_web.py 3137 |
---|
2509 | - self.failUnlessEqual(common.abbreviate_size(None), "") |
---|
2510 | - self.failUnlessEqual(common.abbreviate_size(1.23*1000*1000*1000), "1.23GB") |
---|
2511 | - self.failUnlessEqual(common.abbreviate_size(1.23*1000*1000), "1.23MB") |
---|
2512 | - self.failUnlessEqual(common.abbreviate_size(1230), "1.2kB") |
---|
2513 | - self.failUnlessEqual(common.abbreviate_size(123), "123B") |
---|
2514 | + self.failUnlessReallyEqual(common.abbreviate_size(None), "") |
---|
2515 | + self.failUnlessReallyEqual(common.abbreviate_size(1.23*1000*1000*1000), "1.23GB") |
---|
2516 | + self.failUnlessReallyEqual(common.abbreviate_size(1.23*1000*1000), "1.23MB") |
---|
2517 | + self.failUnlessReallyEqual(common.abbreviate_size(1230), "1.2kB") |
---|
2518 | + self.failUnlessReallyEqual(common.abbreviate_size(123), "123B") |
---|
2519 | |
---|
2520 | def test_plural(self): |
---|
2521 | def convert(s): |
---|
2522 | hunk ./src/allmydata/test/test_web.py 3146 |
---|
2523 | return "%d second%s" % (s, status.plural(s)) |
---|
2524 | - self.failUnlessEqual(convert(0), "0 seconds") |
---|
2525 | - self.failUnlessEqual(convert(1), "1 second") |
---|
2526 | - self.failUnlessEqual(convert(2), "2 seconds") |
---|
2527 | + self.failUnlessReallyEqual(convert(0), "0 seconds") |
---|
2528 | + self.failUnlessReallyEqual(convert(1), "1 second") |
---|
2529 | + self.failUnlessReallyEqual(convert(2), "2 seconds") |
---|
2530 | def convert2(s): |
---|
2531 | return "has share%s: %s" % (status.plural(s), ",".join(s)) |
---|
2532 | hunk ./src/allmydata/test/test_web.py 3151 |
---|
2533 | - self.failUnlessEqual(convert2([]), "has shares: ") |
---|
2534 | - self.failUnlessEqual(convert2(["1"]), "has share: 1") |
---|
2535 | - self.failUnlessEqual(convert2(["1","2"]), "has shares: 1,2") |
---|
2536 | + self.failUnlessReallyEqual(convert2([]), "has shares: ") |
---|
2537 | + self.failUnlessReallyEqual(convert2(["1"]), "has share: 1") |
---|
2538 | + self.failUnlessReallyEqual(convert2(["1","2"]), "has shares: 1,2") |
---|
2539 | |
---|
2540 | |
---|
2541 | hunk ./src/allmydata/test/test_web.py 3156 |
---|
2542 | -class Grid(GridTestMixin, WebErrorMixin, unittest.TestCase, ShouldFailMixin): |
---|
2543 | +class Grid(GridTestMixin, WebErrorMixin, ShouldFailMixin, testutil.ReallyEqualMixin, unittest.TestCase): |
---|
2544 | |
---|
2545 | def CHECK(self, ign, which, args, clientnum=0): |
---|
2546 | fileurl = self.fileurls[which] |
---|
2547 | hunk ./src/allmydata/test/test_web.py 3198 |
---|
2548 | |
---|
2549 | def _clobber_shares(ignored): |
---|
2550 | good_shares = self.find_shares(self.uris["good"]) |
---|
2551 | - self.failUnlessEqual(len(good_shares), 10) |
---|
2552 | + self.failUnlessReallyEqual(len(good_shares), 10) |
---|
2553 | sick_shares = self.find_shares(self.uris["sick"]) |
---|
2554 | os.unlink(sick_shares[0][2]) |
---|
2555 | dead_shares = self.find_shares(self.uris["dead"]) |
---|
2556 | hunk ./src/allmydata/test/test_web.py 3226 |
---|
2557 | d.addCallback(self.CHECK, "good", "t=check&output=json") |
---|
2558 | def _got_json_good(res): |
---|
2559 | r = simplejson.loads(res) |
---|
2560 | - self.failUnlessEqual(r["summary"], "Healthy") |
---|
2561 | + self.failUnlessReallyEqual(r["summary"], "Healthy") |
---|
2562 | self.failUnless(r["results"]["healthy"]) |
---|
2563 | self.failIf(r["results"]["needs-rebalancing"]) |
---|
2564 | self.failUnless(r["results"]["recoverable"]) |
---|
2565 | hunk ./src/allmydata/test/test_web.py 3247 |
---|
2566 | d.addCallback(self.CHECK, "small", "t=check&output=json") |
---|
2567 | def _got_json_small(res): |
---|
2568 | r = simplejson.loads(res) |
---|
2569 | - self.failUnlessEqual(r["storage-index"], "") |
---|
2570 | + self.failUnlessReallyEqual(r["storage-index"], "") |
---|
2571 | self.failUnless(r["results"]["healthy"]) |
---|
2572 | d.addCallback(_got_json_small) |
---|
2573 | |
---|
2574 | hunk ./src/allmydata/test/test_web.py 3259 |
---|
2575 | d.addCallback(self.CHECK, "smalldir", "t=check&output=json") |
---|
2576 | def _got_json_smalldir(res): |
---|
2577 | r = simplejson.loads(res) |
---|
2578 | - self.failUnlessEqual(r["storage-index"], "") |
---|
2579 | + self.failUnlessReallyEqual(r["storage-index"], "") |
---|
2580 | self.failUnless(r["results"]["healthy"]) |
---|
2581 | d.addCallback(_got_json_smalldir) |
---|
2582 | |
---|
2583 | hunk ./src/allmydata/test/test_web.py 3270 |
---|
2584 | d.addCallback(self.CHECK, "sick", "t=check&output=json") |
---|
2585 | def _got_json_sick(res): |
---|
2586 | r = simplejson.loads(res) |
---|
2587 | - self.failUnlessEqual(r["summary"], |
---|
2588 | - "Not Healthy: 9 shares (enc 3-of-10)") |
---|
2589 | + self.failUnlessReallyEqual(r["summary"], |
---|
2590 | + "Not Healthy: 9 shares (enc 3-of-10)") |
---|
2591 | self.failIf(r["results"]["healthy"]) |
---|
2592 | self.failIf(r["results"]["needs-rebalancing"]) |
---|
2593 | self.failUnless(r["results"]["recoverable"]) |
---|
2594 | hunk ./src/allmydata/test/test_web.py 3284 |
---|
2595 | d.addCallback(self.CHECK, "dead", "t=check&output=json") |
---|
2596 | def _got_json_dead(res): |
---|
2597 | r = simplejson.loads(res) |
---|
2598 | - self.failUnlessEqual(r["summary"], |
---|
2599 | - "Not Healthy: 1 shares (enc 3-of-10)") |
---|
2600 | + self.failUnlessReallyEqual(r["summary"], |
---|
2601 | + "Not Healthy: 1 shares (enc 3-of-10)") |
---|
2602 | self.failIf(r["results"]["healthy"]) |
---|
2603 | self.failIf(r["results"]["needs-rebalancing"]) |
---|
2604 | self.failIf(r["results"]["recoverable"]) |
---|
2605 | hunk ./src/allmydata/test/test_web.py 3302 |
---|
2606 | r["summary"]) |
---|
2607 | self.failIf(r["results"]["healthy"]) |
---|
2608 | self.failUnless(r["results"]["recoverable"]) |
---|
2609 | - self.failUnlessEqual(r["results"]["count-shares-good"], 9) |
---|
2610 | - self.failUnlessEqual(r["results"]["count-corrupt-shares"], 1) |
---|
2611 | + self.failUnlessReallyEqual(r["results"]["count-shares-good"], 9) |
---|
2612 | + self.failUnlessReallyEqual(r["results"]["count-corrupt-shares"], 1) |
---|
2613 | d.addCallback(_got_json_corrupt) |
---|
2614 | |
---|
2615 | d.addErrback(self.explain_web_error) |
---|
2616 | hunk ./src/allmydata/test/test_web.py 3339 |
---|
2617 | |
---|
2618 | def _clobber_shares(ignored): |
---|
2619 | good_shares = self.find_shares(self.uris["good"]) |
---|
2620 | - self.failUnlessEqual(len(good_shares), 10) |
---|
2621 | + self.failUnlessReallyEqual(len(good_shares), 10) |
---|
2622 | sick_shares = self.find_shares(self.uris["sick"]) |
---|
2623 | os.unlink(sick_shares[0][2]) |
---|
2624 | dead_shares = self.find_shares(self.uris["dead"]) |
---|
2625 | hunk ./src/allmydata/test/test_web.py 3413 |
---|
2626 | d.addCallback(self.CHECK, "sick", "t=check&repair=true&output=json") |
---|
2627 | def _got_json_sick(res): |
---|
2628 | r = simplejson.loads(res) |
---|
2629 | - self.failUnlessEqual(r["repair-attempted"], True) |
---|
2630 | - self.failUnlessEqual(r["repair-successful"], True) |
---|
2631 | - self.failUnlessEqual(r["pre-repair-results"]["summary"], |
---|
2632 | - "Not Healthy: 9 shares (enc 3-of-10)") |
---|
2633 | + self.failUnlessReallyEqual(r["repair-attempted"], True) |
---|
2634 | + self.failUnlessReallyEqual(r["repair-successful"], True) |
---|
2635 | + self.failUnlessReallyEqual(r["pre-repair-results"]["summary"], |
---|
2636 | + "Not Healthy: 9 shares (enc 3-of-10)") |
---|
2637 | self.failIf(r["pre-repair-results"]["results"]["healthy"]) |
---|
2638 | hunk ./src/allmydata/test/test_web.py 3418 |
---|
2639 | - self.failUnlessEqual(r["post-repair-results"]["summary"], "healthy") |
---|
2640 | + self.failUnlessReallyEqual(r["post-repair-results"]["summary"], "healthy") |
---|
2641 | self.failUnless(r["post-repair-results"]["results"]["healthy"]) |
---|
2642 | d.addCallback(_got_json_sick) |
---|
2643 | |
---|
2644 | hunk ./src/allmydata/test/test_web.py 3466 |
---|
2645 | # find the More Info link for name, should be relative |
---|
2646 | mo = re.search(r'<a href="([^"]+)">More Info</a>', res) |
---|
2647 | info_url = mo.group(1) |
---|
2648 | - self.failUnlessEqual(info_url, "%s?t=info" % (str(name),)) |
---|
2649 | + self.failUnlessReallyEqual(info_url, "%s?t=info" % (str(name),)) |
---|
2650 | if immutable: |
---|
2651 | d.addCallback(_check_directory_html, "-IMM") |
---|
2652 | else: |
---|
2653 | hunk ./src/allmydata/test/test_web.py 3475 |
---|
2654 | d.addCallback(lambda ign: self.GET(self.rooturl+"?t=json")) |
---|
2655 | def _check_directory_json(res, expect_rw_uri): |
---|
2656 | data = simplejson.loads(res) |
---|
2657 | - self.failUnlessEqual(data[0], "dirnode") |
---|
2658 | + self.failUnlessReallyEqual(data[0], "dirnode") |
---|
2659 | f = data[1]["children"][name] |
---|
2660 | hunk ./src/allmydata/test/test_web.py 3477 |
---|
2661 | - self.failUnlessEqual(f[0], "unknown") |
---|
2662 | + self.failUnlessReallyEqual(f[0], "unknown") |
---|
2663 | if expect_rw_uri: |
---|
2664 | hunk ./src/allmydata/test/test_web.py 3479 |
---|
2665 | - self.failUnlessEqual(f[1]["rw_uri"], unknown_rwcap) |
---|
2666 | + self.failUnlessReallyEqual(f[1]["rw_uri"], unknown_rwcap.decode('utf-8')) |
---|
2667 | else: |
---|
2668 | self.failIfIn("rw_uri", f[1]) |
---|
2669 | if immutable: |
---|
2670 | hunk ./src/allmydata/test/test_web.py 3483 |
---|
2671 | - self.failUnlessEqual(f[1]["ro_uri"], unknown_immcap, data) |
---|
2672 | + self.failUnlessReallyEqual(f[1]["ro_uri"], unknown_immcap.decode('utf-8'), data) |
---|
2673 | else: |
---|
2674 | hunk ./src/allmydata/test/test_web.py 3485 |
---|
2675 | - self.failUnlessEqual(f[1]["ro_uri"], unknown_rocap) |
---|
2676 | + self.failUnlessReallyEqual(f[1]["ro_uri"], unknown_rocap.decode('utf-8')) |
---|
2677 | self.failUnless("metadata" in f[1]) |
---|
2678 | d.addCallback(_check_directory_json, expect_rw_uri=not immutable) |
---|
2679 | |
---|
2680 | hunk ./src/allmydata/test/test_web.py 3516 |
---|
2681 | |
---|
2682 | def _check_json(res, expect_rw_uri): |
---|
2683 | data = simplejson.loads(res) |
---|
2684 | - self.failUnlessEqual(data[0], "unknown") |
---|
2685 | + self.failUnlessReallyEqual(data[0], "unknown") |
---|
2686 | if expect_rw_uri: |
---|
2687 | hunk ./src/allmydata/test/test_web.py 3518 |
---|
2688 | - self.failUnlessEqual(data[1]["rw_uri"], unknown_rwcap) |
---|
2689 | + self.failUnlessReallyEqual(data[1]["rw_uri"], unknown_rwcap.decode('utf-8')) |
---|
2690 | else: |
---|
2691 | self.failIfIn("rw_uri", data[1]) |
---|
2692 | |
---|
2693 | hunk ./src/allmydata/test/test_web.py 3523 |
---|
2694 | if immutable: |
---|
2695 | - self.failUnlessEqual(data[1]["ro_uri"], unknown_immcap) |
---|
2696 | - self.failUnlessEqual(data[1]["mutable"], False) |
---|
2697 | + self.failUnlessReallyEqual(data[1]["ro_uri"], unknown_immcap.decode('utf-8')) |
---|
2698 | + self.failUnlessReallyEqual(data[1]["mutable"], False) |
---|
2699 | elif expect_rw_uri: |
---|
2700 | hunk ./src/allmydata/test/test_web.py 3526 |
---|
2701 | - self.failUnlessEqual(data[1]["ro_uri"], unknown_rocap) |
---|
2702 | - self.failUnlessEqual(data[1]["mutable"], True) |
---|
2703 | + self.failUnlessReallyEqual(data[1]["ro_uri"], unknown_rocap.decode('utf-8')) |
---|
2704 | + self.failUnlessReallyEqual(data[1]["mutable"], True) |
---|
2705 | else: |
---|
2706 | hunk ./src/allmydata/test/test_web.py 3529 |
---|
2707 | - self.failUnlessEqual(data[1]["ro_uri"], unknown_rocap) |
---|
2708 | + self.failUnlessReallyEqual(data[1]["ro_uri"], unknown_rocap.decode('utf-8')) |
---|
2709 | self.failIf("mutable" in data[1], data[1]) |
---|
2710 | |
---|
2711 | # TODO: check metadata contents |
---|
2712 | hunk ./src/allmydata/test/test_web.py 3636 |
---|
2713 | self.failUnless(rwcapdata == "") |
---|
2714 | self.failUnless(name in kids) |
---|
2715 | (expected_child, ign) = kids[name] |
---|
2716 | - self.failUnlessEqual(ro_uri, expected_child.get_readonly_uri()) |
---|
2717 | + self.failUnlessReallyEqual(ro_uri, expected_child.get_readonly_uri()) |
---|
2718 | numkids += 1 |
---|
2719 | |
---|
2720 | hunk ./src/allmydata/test/test_web.py 3639 |
---|
2721 | - self.failUnlessEqual(numkids, 3) |
---|
2722 | + self.failUnlessReallyEqual(numkids, 3) |
---|
2723 | return self.rootnode.list() |
---|
2724 | d.addCallback(_check_data) |
---|
2725 | |
---|
2726 | hunk ./src/allmydata/test/test_web.py 3645 |
---|
2727 | # Now when we use the real directory listing code, the mutants should be absent. |
---|
2728 | def _check_kids(children): |
---|
2729 | - self.failUnlessEqual(sorted(children.keys()), [u"lonely"]) |
---|
2730 | + self.failUnlessReallyEqual(sorted(children.keys()), [u"lonely"]) |
---|
2731 | lonely_node, lonely_metadata = children[u"lonely"] |
---|
2732 | |
---|
2733 | hunk ./src/allmydata/test/test_web.py 3648 |
---|
2734 | - self.failUnlessEqual(lonely_node.get_write_uri(), None) |
---|
2735 | - self.failUnlessEqual(lonely_node.get_readonly_uri(), lonely_uri) |
---|
2736 | + self.failUnlessReallyEqual(lonely_node.get_write_uri(), None) |
---|
2737 | + self.failUnlessReallyEqual(lonely_node.get_readonly_uri(), lonely_uri) |
---|
2738 | d.addCallback(_check_kids) |
---|
2739 | |
---|
2740 | d.addCallback(lambda ign: nm.create_from_cap(self.cap.to_string())) |
---|
2741 | hunk ./src/allmydata/test/test_web.py 3678 |
---|
2742 | d.addCallback(lambda ign: self.GET(self.rooturl+"?t=json")) |
---|
2743 | def _check_json(res): |
---|
2744 | data = simplejson.loads(res) |
---|
2745 | - self.failUnlessEqual(data[0], "dirnode") |
---|
2746 | + self.failUnlessReallyEqual(data[0], "dirnode") |
---|
2747 | listed_children = data[1]["children"] |
---|
2748 | hunk ./src/allmydata/test/test_web.py 3680 |
---|
2749 | - self.failUnlessEqual(sorted(listed_children.keys()), [u"lonely"]) |
---|
2750 | + self.failUnlessReallyEqual(sorted(listed_children.keys()), [u"lonely"]) |
---|
2751 | ll_type, ll_data = listed_children[u"lonely"] |
---|
2752 | hunk ./src/allmydata/test/test_web.py 3682 |
---|
2753 | - self.failUnlessEqual(ll_type, "filenode") |
---|
2754 | + self.failUnlessReallyEqual(ll_type, "filenode") |
---|
2755 | self.failIf("rw_uri" in ll_data) |
---|
2756 | hunk ./src/allmydata/test/test_web.py 3684 |
---|
2757 | - self.failUnlessEqual(ll_data["ro_uri"], lonely_uri) |
---|
2758 | + self.failUnlessReallyEqual(ll_data["ro_uri"], lonely_uri) |
---|
2759 | d.addCallback(_check_json) |
---|
2760 | return d |
---|
2761 | |
---|
2762 | hunk ./src/allmydata/test/test_web.py 3741 |
---|
2763 | print "response is:", res |
---|
2764 | print "undecodeable line was '%s'" % line |
---|
2765 | raise |
---|
2766 | - self.failUnlessEqual(len(units), 5+1) |
---|
2767 | + self.failUnlessReallyEqual(len(units), 5+1) |
---|
2768 | # should be parent-first |
---|
2769 | u0 = units[0] |
---|
2770 | hunk ./src/allmydata/test/test_web.py 3744 |
---|
2771 | - self.failUnlessEqual(u0["path"], []) |
---|
2772 | - self.failUnlessEqual(u0["type"], "directory") |
---|
2773 | - self.failUnlessEqual(u0["cap"], self.rootnode.get_uri()) |
---|
2774 | + self.failUnlessReallyEqual(u0["path"], []) |
---|
2775 | + self.failUnlessReallyEqual(u0["type"], "directory") |
---|
2776 | + self.failUnlessReallyEqual(u0["cap"], self.rootnode.get_uri()) |
---|
2777 | u0cr = u0["check-results"] |
---|
2778 | hunk ./src/allmydata/test/test_web.py 3748 |
---|
2779 | - self.failUnlessEqual(u0cr["results"]["count-shares-good"], 10) |
---|
2780 | + self.failUnlessReallyEqual(u0cr["results"]["count-shares-good"], 10) |
---|
2781 | |
---|
2782 | ugood = [u for u in units |
---|
2783 | if u["type"] == "file" and u["path"] == [u"good"]][0] |
---|
2784 | hunk ./src/allmydata/test/test_web.py 3752 |
---|
2785 | - self.failUnlessEqual(ugood["cap"], self.uris["good"]) |
---|
2786 | + self.failUnlessReallyEqual(ugood["cap"], self.uris["good"]) |
---|
2787 | ugoodcr = ugood["check-results"] |
---|
2788 | hunk ./src/allmydata/test/test_web.py 3754 |
---|
2789 | - self.failUnlessEqual(ugoodcr["results"]["count-shares-good"], 10) |
---|
2790 | + self.failUnlessReallyEqual(ugoodcr["results"]["count-shares-good"], 10) |
---|
2791 | |
---|
2792 | stats = units[-1] |
---|
2793 | hunk ./src/allmydata/test/test_web.py 3757 |
---|
2794 | - self.failUnlessEqual(stats["type"], "stats") |
---|
2795 | + self.failUnlessReallyEqual(stats["type"], "stats") |
---|
2796 | s = stats["stats"] |
---|
2797 | hunk ./src/allmydata/test/test_web.py 3759 |
---|
2798 | - self.failUnlessEqual(s["count-immutable-files"], 2) |
---|
2799 | - self.failUnlessEqual(s["count-literal-files"], 1) |
---|
2800 | - self.failUnlessEqual(s["count-directories"], 1) |
---|
2801 | - self.failUnlessEqual(s["count-unknown"], 1) |
---|
2802 | + self.failUnlessReallyEqual(s["count-immutable-files"], 2) |
---|
2803 | + self.failUnlessReallyEqual(s["count-literal-files"], 1) |
---|
2804 | + self.failUnlessReallyEqual(s["count-directories"], 1) |
---|
2805 | + self.failUnlessReallyEqual(s["count-unknown"], 1) |
---|
2806 | d.addCallback(_done) |
---|
2807 | |
---|
2808 | d.addCallback(self.CHECK, "root", "t=stream-manifest") |
---|
2809 | hunk ./src/allmydata/test/test_web.py 3769 |
---|
2810 | def _check_manifest(res): |
---|
2811 | self.failUnless(res.endswith("\n")) |
---|
2812 | units = [simplejson.loads(t) for t in res[:-1].split("\n")] |
---|
2813 | - self.failUnlessEqual(len(units), 5+1) |
---|
2814 | - self.failUnlessEqual(units[-1]["type"], "stats") |
---|
2815 | + self.failUnlessReallyEqual(len(units), 5+1) |
---|
2816 | + self.failUnlessReallyEqual(units[-1]["type"], "stats") |
---|
2817 | first = units[0] |
---|
2818 | hunk ./src/allmydata/test/test_web.py 3772 |
---|
2819 | - self.failUnlessEqual(first["path"], []) |
---|
2820 | - self.failUnlessEqual(first["cap"], self.rootnode.get_uri()) |
---|
2821 | - self.failUnlessEqual(first["type"], "directory") |
---|
2822 | + self.failUnlessReallyEqual(first["path"], []) |
---|
2823 | + self.failUnlessReallyEqual(first["cap"], self.rootnode.get_uri()) |
---|
2824 | + self.failUnlessReallyEqual(first["type"], "directory") |
---|
2825 | stats = units[-1]["stats"] |
---|
2826 | hunk ./src/allmydata/test/test_web.py 3776 |
---|
2827 | - self.failUnlessEqual(stats["count-immutable-files"], 2) |
---|
2828 | - self.failUnlessEqual(stats["count-literal-files"], 1) |
---|
2829 | - self.failUnlessEqual(stats["count-mutable-files"], 0) |
---|
2830 | - self.failUnlessEqual(stats["count-immutable-files"], 2) |
---|
2831 | - self.failUnlessEqual(stats["count-unknown"], 1) |
---|
2832 | + self.failUnlessReallyEqual(stats["count-immutable-files"], 2) |
---|
2833 | + self.failUnlessReallyEqual(stats["count-literal-files"], 1) |
---|
2834 | + self.failUnlessReallyEqual(stats["count-mutable-files"], 0) |
---|
2835 | + self.failUnlessReallyEqual(stats["count-immutable-files"], 2) |
---|
2836 | + self.failUnlessReallyEqual(stats["count-unknown"], 1) |
---|
2837 | d.addCallback(_check_manifest) |
---|
2838 | |
---|
2839 | # now add root/subdir and root/subdir/grandchild, then make subdir |
---|
2840 | hunk ./src/allmydata/test/test_web.py 3826 |
---|
2841 | error_line) |
---|
2842 | self.failUnless(len(error_msg) > 2, error_msg_s) # some traceback |
---|
2843 | units = [simplejson.loads(line) for line in lines[:first_error]] |
---|
2844 | - self.failUnlessEqual(len(units), 6) # includes subdir |
---|
2845 | + self.failUnlessReallyEqual(len(units), 6) # includes subdir |
---|
2846 | last_unit = units[-1] |
---|
2847 | hunk ./src/allmydata/test/test_web.py 3828 |
---|
2848 | - self.failUnlessEqual(last_unit["path"], ["subdir"]) |
---|
2849 | + self.failUnlessReallyEqual(last_unit["path"], ["subdir"]) |
---|
2850 | d.addCallback(_check_broken_manifest) |
---|
2851 | |
---|
2852 | d.addCallback(self.CHECK, "root", "t=stream-deep-check") |
---|
2853 | hunk ./src/allmydata/test/test_web.py 3847 |
---|
2854 | error_line) |
---|
2855 | self.failUnless(len(error_msg) > 2, error_msg_s) # some traceback |
---|
2856 | units = [simplejson.loads(line) for line in lines[:first_error]] |
---|
2857 | - self.failUnlessEqual(len(units), 6) # includes subdir |
---|
2858 | + self.failUnlessReallyEqual(len(units), 6) # includes subdir |
---|
2859 | last_unit = units[-1] |
---|
2860 | hunk ./src/allmydata/test/test_web.py 3849 |
---|
2861 | - self.failUnlessEqual(last_unit["path"], ["subdir"]) |
---|
2862 | + self.failUnlessReallyEqual(last_unit["path"], ["subdir"]) |
---|
2863 | r = last_unit["check-results"]["results"] |
---|
2864 | hunk ./src/allmydata/test/test_web.py 3851 |
---|
2865 | - self.failUnlessEqual(r["count-recoverable-versions"], 0) |
---|
2866 | - self.failUnlessEqual(r["count-shares-good"], 1) |
---|
2867 | - self.failUnlessEqual(r["recoverable"], False) |
---|
2868 | + self.failUnlessReallyEqual(r["count-recoverable-versions"], 0) |
---|
2869 | + self.failUnlessReallyEqual(r["count-shares-good"], 1) |
---|
2870 | + self.failUnlessReallyEqual(r["recoverable"], False) |
---|
2871 | d.addCallback(_check_broken_deepcheck) |
---|
2872 | |
---|
2873 | d.addErrback(self.explain_web_error) |
---|
2874 | hunk ./src/allmydata/test/test_web.py 3897 |
---|
2875 | |
---|
2876 | def _clobber_shares(ignored): |
---|
2877 | good_shares = self.find_shares(self.uris["good"]) |
---|
2878 | - self.failUnlessEqual(len(good_shares), 10) |
---|
2879 | + self.failUnlessReallyEqual(len(good_shares), 10) |
---|
2880 | sick_shares = self.find_shares(self.uris["sick"]) |
---|
2881 | os.unlink(sick_shares[0][2]) |
---|
2882 | #dead_shares = self.find_shares(self.uris["dead"]) |
---|
2883 | hunk ./src/allmydata/test/test_web.py 3921 |
---|
2884 | units = [simplejson.loads(line) |
---|
2885 | for line in res.splitlines() |
---|
2886 | if line] |
---|
2887 | - self.failUnlessEqual(len(units), 4+1) |
---|
2888 | + self.failUnlessReallyEqual(len(units), 4+1) |
---|
2889 | # should be parent-first |
---|
2890 | u0 = units[0] |
---|
2891 | hunk ./src/allmydata/test/test_web.py 3924 |
---|
2892 | - self.failUnlessEqual(u0["path"], []) |
---|
2893 | - self.failUnlessEqual(u0["type"], "directory") |
---|
2894 | - self.failUnlessEqual(u0["cap"], self.rootnode.get_uri()) |
---|
2895 | + self.failUnlessReallyEqual(u0["path"], []) |
---|
2896 | + self.failUnlessReallyEqual(u0["type"], "directory") |
---|
2897 | + self.failUnlessReallyEqual(u0["cap"], self.rootnode.get_uri()) |
---|
2898 | u0crr = u0["check-and-repair-results"] |
---|
2899 | hunk ./src/allmydata/test/test_web.py 3928 |
---|
2900 | - self.failUnlessEqual(u0crr["repair-attempted"], False) |
---|
2901 | - self.failUnlessEqual(u0crr["pre-repair-results"]["results"]["count-shares-good"], 10) |
---|
2902 | + self.failUnlessReallyEqual(u0crr["repair-attempted"], False) |
---|
2903 | + self.failUnlessReallyEqual(u0crr["pre-repair-results"]["results"]["count-shares-good"], 10) |
---|
2904 | |
---|
2905 | ugood = [u for u in units |
---|
2906 | if u["type"] == "file" and u["path"] == [u"good"]][0] |
---|
2907 | hunk ./src/allmydata/test/test_web.py 3933 |
---|
2908 | - self.failUnlessEqual(ugood["cap"], self.uris["good"]) |
---|
2909 | + self.failUnlessReallyEqual(ugood["cap"], self.uris["good"]) |
---|
2910 | ugoodcrr = ugood["check-and-repair-results"] |
---|
2911 | hunk ./src/allmydata/test/test_web.py 3935 |
---|
2912 | - self.failUnlessEqual(ugoodcrr["repair-attempted"], False) |
---|
2913 | - self.failUnlessEqual(ugoodcrr["pre-repair-results"]["results"]["count-shares-good"], 10) |
---|
2914 | + self.failUnlessReallyEqual(ugoodcrr["repair-attempted"], False) |
---|
2915 | + self.failUnlessReallyEqual(ugoodcrr["pre-repair-results"]["results"]["count-shares-good"], 10) |
---|
2916 | |
---|
2917 | usick = [u for u in units |
---|
2918 | if u["type"] == "file" and u["path"] == [u"sick"]][0] |
---|
2919 | hunk ./src/allmydata/test/test_web.py 3940 |
---|
2920 | - self.failUnlessEqual(usick["cap"], self.uris["sick"]) |
---|
2921 | + self.failUnlessReallyEqual(usick["cap"], self.uris["sick"]) |
---|
2922 | usickcrr = usick["check-and-repair-results"] |
---|
2923 | hunk ./src/allmydata/test/test_web.py 3942 |
---|
2924 | - self.failUnlessEqual(usickcrr["repair-attempted"], True) |
---|
2925 | - self.failUnlessEqual(usickcrr["repair-successful"], True) |
---|
2926 | - self.failUnlessEqual(usickcrr["pre-repair-results"]["results"]["count-shares-good"], 9) |
---|
2927 | - self.failUnlessEqual(usickcrr["post-repair-results"]["results"]["count-shares-good"], 10) |
---|
2928 | + self.failUnlessReallyEqual(usickcrr["repair-attempted"], True) |
---|
2929 | + self.failUnlessReallyEqual(usickcrr["repair-successful"], True) |
---|
2930 | + self.failUnlessReallyEqual(usickcrr["pre-repair-results"]["results"]["count-shares-good"], 9) |
---|
2931 | + self.failUnlessReallyEqual(usickcrr["post-repair-results"]["results"]["count-shares-good"], 10) |
---|
2932 | |
---|
2933 | stats = units[-1] |
---|
2934 | hunk ./src/allmydata/test/test_web.py 3948 |
---|
2935 | - self.failUnlessEqual(stats["type"], "stats") |
---|
2936 | + self.failUnlessReallyEqual(stats["type"], "stats") |
---|
2937 | s = stats["stats"] |
---|
2938 | hunk ./src/allmydata/test/test_web.py 3950 |
---|
2939 | - self.failUnlessEqual(s["count-immutable-files"], 2) |
---|
2940 | - self.failUnlessEqual(s["count-literal-files"], 1) |
---|
2941 | - self.failUnlessEqual(s["count-directories"], 1) |
---|
2942 | + self.failUnlessReallyEqual(s["count-immutable-files"], 2) |
---|
2943 | + self.failUnlessReallyEqual(s["count-literal-files"], 1) |
---|
2944 | + self.failUnlessReallyEqual(s["count-directories"], 1) |
---|
2945 | d.addCallback(_done) |
---|
2946 | |
---|
2947 | d.addErrback(self.explain_web_error) |
---|
2948 | hunk ./src/allmydata/test/test_web.py 4099 |
---|
2949 | for line in res.splitlines() |
---|
2950 | if line] |
---|
2951 | # root, one, small, mutable, stats |
---|
2952 | - self.failUnlessEqual(len(units), 4+1) |
---|
2953 | + self.failUnlessReallyEqual(len(units), 4+1) |
---|
2954 | d.addCallback(_done) |
---|
2955 | |
---|
2956 | d.addCallback(self._count_leases, "root") |
---|
2957 | hunk ./src/allmydata/test/test_web.py 4189 |
---|
2958 | "severe corruption. You should perform a filecheck on " |
---|
2959 | "this object to learn more. The full error message is: " |
---|
2960 | "Failed to get enough shareholders: have 0, need 3") |
---|
2961 | - self.failUnlessEqual(exp, body) |
---|
2962 | + self.failUnlessReallyEqual(exp, body) |
---|
2963 | d.addCallback(_check_zero_shares) |
---|
2964 | |
---|
2965 | |
---|
2966 | hunk ./src/allmydata/test/test_web.py 4206 |
---|
2967 | "corruption. You should perform a filecheck on " |
---|
2968 | "this object to learn more. The full error message is:" |
---|
2969 | " Failed to get enough shareholders: have 1, need 3") |
---|
2970 | - self.failUnlessEqual(exp, body) |
---|
2971 | + self.failUnlessReallyEqual(exp, body) |
---|
2972 | d.addCallback(_check_one_share) |
---|
2973 | |
---|
2974 | d.addCallback(lambda ignored: |
---|
2975 | hunk ./src/allmydata/test/test_web.py 4272 |
---|
2976 | "was corrupt, or that shares have been lost due to server " |
---|
2977 | "departure, hard drive failure, or disk corruption. You " |
---|
2978 | "should perform a filecheck on this object to learn more.") |
---|
2979 | - self.failUnlessEqual(exp, body) |
---|
2980 | + self.failUnlessReallyEqual(exp, body) |
---|
2981 | d.addCallback(_check_unrecoverable_file) |
---|
2982 | |
---|
2983 | d.addCallback(lambda ignored: |
---|
2984 | } |
---|
2985 | |
---|
2986 | Context: |
---|
2987 | |
---|
2988 | [upcase_since_on_welcome |
---|
2989 | terrellrussell@gmail.com**20100708193903] |
---|
2990 | [server_version_on_welcome_page.dpatch.txt |
---|
2991 | freestorm77@gmail.com**20100605191721 |
---|
2992 | Ignore-this: b450c76dc875f5ac8cca229a666cbd0a |
---|
2993 | |
---|
2994 | |
---|
2995 | - The storage server version is 0 for all storage nodes in the Welcome Page |
---|
2996 | |
---|
2997 | |
---|
2998 | ] |
---|
2999 | [NEWS: add NEWS snippets about two recent patches |
---|
3000 | zooko@zooko.com**20100708162058 |
---|
3001 | Ignore-this: 6c9da6a0ad7351a960bdd60f81532899 |
---|
3002 | ] |
---|
3003 | [directory_html_top_banner.dpatch |
---|
3004 | freestorm77@gmail.com**20100622205301 |
---|
3005 | Ignore-this: 1d770d975e0c414c996564774f049bca |
---|
3006 | |
---|
3007 | The div tag with the link "Return to Welcome page" on the directory.xhtml page is not correct |
---|
3008 | |
---|
3009 | ] |
---|
3010 | [tahoe_css_toolbar.dpatch |
---|
3011 | freestorm77@gmail.com**20100622210046 |
---|
3012 | Ignore-this: 5b3ebb2e0f52bbba718a932f80c246c0 |
---|
3013 | |
---|
3014 | CSS modification to be correctly diplayed with Internet Explorer 8 |
---|
3015 | |
---|
3016 | The links on the top of page directory.xhtml are not diplayed in the same line as display with Firefox. |
---|
3017 | |
---|
3018 | ] |
---|
3019 | [runnin_test_tahoe_css.dpatch |
---|
3020 | freestorm77@gmail.com**20100622214714 |
---|
3021 | Ignore-this: e0db73d68740aad09a7b9ae60a08c05c |
---|
3022 | |
---|
3023 | Runnin test for changes in tahoe.css file |
---|
3024 | |
---|
3025 | ] |
---|
3026 | [runnin_test_directory_xhtml.dpatch |
---|
3027 | freestorm77@gmail.com**20100622201403 |
---|
3028 | Ignore-this: f8962463fce50b9466405cb59fe11d43 |
---|
3029 | |
---|
3030 | Runnin test for diretory.xhtml top banner |
---|
3031 | |
---|
3032 | ] |
---|
3033 | [stringutils.py: tolerate sys.stdout having no 'encoding' attribute. |
---|
3034 | david-sarah@jacaranda.org**20100626040817 |
---|
3035 | Ignore-this: f42cad81cef645ee38ac1df4660cc850 |
---|
3036 | ] |
---|
3037 | [quickstart.html: python 2.5 -> 2.6 as recommended version |
---|
3038 | david-sarah@jacaranda.org**20100705175858 |
---|
3039 | Ignore-this: bc3a14645ea1d5435002966ae903199f |
---|
3040 | ] |
---|
3041 | [SFTP: don't call .stopProducing on the producer registered with OverwriteableFileConsumer (which breaks with warner's new downloader). |
---|
3042 | david-sarah@jacaranda.org**20100628231926 |
---|
3043 | Ignore-this: 131b7a5787bc85a9a356b5740d9d996f |
---|
3044 | ] |
---|
3045 | [docs/how_to_make_a_tahoe-lafs_release.txt: trivial correction, install.html should now be quickstart.html. |
---|
3046 | david-sarah@jacaranda.org**20100625223929 |
---|
3047 | Ignore-this: 99a5459cac51bd867cc11ad06927ff30 |
---|
3048 | ] |
---|
3049 | [setup: in the Makefile, refuse to upload tarballs unless someone has passed the environment variable "BB_BRANCH" with value "trunk" |
---|
3050 | zooko@zooko.com**20100619034928 |
---|
3051 | Ignore-this: 276ddf9b6ad7ec79e27474862e0f7d6 |
---|
3052 | ] |
---|
3053 | [trivial: tiny update to in-line comment |
---|
3054 | zooko@zooko.com**20100614045715 |
---|
3055 | Ignore-this: 10851b0ed2abfed542c97749e5d280bc |
---|
3056 | (I'm actually committing this patch as a test of the new eager-annotation-computation of trac-darcs.) |
---|
3057 | ] |
---|
3058 | [docs: about.html link to home page early on, and be decentralized storage instead of cloud storage this time around |
---|
3059 | zooko@zooko.com**20100619065318 |
---|
3060 | Ignore-this: dc6db03f696e5b6d2848699e754d8053 |
---|
3061 | ] |
---|
3062 | [docs: update about.html, especially to have a non-broken link to quickstart.html, and also to comment out the broken links to "for Paranoids" and "for Corporates" |
---|
3063 | zooko@zooko.com**20100619065124 |
---|
3064 | Ignore-this: e292c7f51c337a84ebfeb366fbd24d6c |
---|
3065 | ] |
---|
3066 | [TAG allmydata-tahoe-1.7.0 |
---|
3067 | zooko@zooko.com**20100619052631 |
---|
3068 | Ignore-this: d21e27afe6d85e2e3ba6a3292ba2be1 |
---|
3069 | ] |
---|
3070 | Patch bundle hash: |
---|
3071 | 21fd7975e277394d193e1f00a70dfc844c1d7b76 |
---|