From 9d5e438c2d36d336da24d081d1bd2acc7f7501c5 Mon Sep 17 00:00:00 2001 From: meejah Date: Fri, 12 Jun 2020 22:57:38 -0600 Subject: [PATCH] use real parser --- src/allmydata/test/test_testing.py | 11 ++++++++--- src/allmydata/testing/web.py | 2 +- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/allmydata/test/test_testing.py b/src/allmydata/test/test_testing.py index a5c712d77..b5bbacad4 100644 --- a/src/allmydata/test/test_testing.py +++ b/src/allmydata/test/test_testing.py @@ -15,6 +15,10 @@ from twisted.internet.defer import ( inlineCallbacks, ) +from allmydata.uri import ( + from_string, + CHKFileURI, +) from allmydata.testing.web import ( create_tahoe_treq_client, ) @@ -60,11 +64,12 @@ class FakeWebTest(TestCase): resp = yield self.http_client.put("http://example.com/uri", content) self.assertEqual(resp.code, 201) - cap = yield resp.content() - self.assertTrue(cap.startswith("URI:CHK:")) + cap_raw = yield resp.content() + cap = from_string(cap_raw) + self.assertIsInstance(cap, CHKFileURI) resp = yield self.http_client.get( - "http://example.com/uri?uri={}".format(cap) + "http://example.com/uri?uri={}".format(cap.to_string()) ) self.assertEqual(resp.code, 200) diff --git a/src/allmydata/testing/web.py b/src/allmydata/testing/web.py index 99dabeddf..f6411792d 100644 --- a/src/allmydata/testing/web.py +++ b/src/allmydata/testing/web.py @@ -90,7 +90,7 @@ def capability_generator(kind): key = base32.b2a(key_hasher.digest()[:16]) # key is 16 bytes ueb_hash = base32.b2a(ueb_hasher.digest()) # ueb hash is 32 bytes - cap = u"{kind}:{key}:{ueb_hash}:{n}:{k}:{size}".format( + cap = u"{kind}{key}:{ueb_hash}:{n}:{k}:{size}".format( kind=kind, key=key, ueb_hash=ueb_hash,