From 015394a0f5f6425dcaf2ff1ab8a30a25ff3f6066 Mon Sep 17 00:00:00 2001
From: Jean-Paul Calderone <exarkun@twistedmatrix.com>
Date: Mon, 11 Nov 2019 16:19:52 -0500
Subject: [PATCH] Correct the implementation too - ZKAP to blinded token

---
 src/_zkapauthorizer/resource.py                   | 14 +++++++-------
 src/_zkapauthorizer/tests/test_client_resource.py | 15 +++++++++------
 2 files changed, 16 insertions(+), 13 deletions(-)

diff --git a/src/_zkapauthorizer/resource.py b/src/_zkapauthorizer/resource.py
index c180a5b..6e5409b 100644
--- a/src/_zkapauthorizer/resource.py
+++ b/src/_zkapauthorizer/resource.py
@@ -78,8 +78,8 @@ def from_configuration(node_config, store, redeemer=None):
         ),
     )
     root.putChild(
-        b"zkap",
-        _ZKAPCollection(
+        b"blinded-token",
+        _BlindedTokenCollection(
             store,
             controller,
         ),
@@ -96,10 +96,10 @@ def application_json(request):
     request.responseHeaders.setRawHeaders(u"content-type", [u"application/json"])
 
 
-class _ZKAPCollection(Resource):
+class _BlindedTokenCollection(Resource):
     """
-    This class implements inspection of ZKAPs.  Users **GET** this resource to
-    find out about ZKAPs in the system.
+    This class implements inspection of blinded tokens.  Users **GET** this
+    resource to find out about blinded tokens in the system.
     """
     _log = Logger()
 
@@ -110,10 +110,10 @@ class _ZKAPCollection(Resource):
 
     def render_GET(self, request):
         """
-        Retrieve some ZKAPs and associated informatin.
+        Retrieve some blinded tokens and associated information.
         """
         application_json(request)
-        return dumps({u"total": 0, u"zkaps": []})
+        return dumps({u"total": 0, u"blinded-tokens": []})
 
 
 
diff --git a/src/_zkapauthorizer/tests/test_client_resource.py b/src/_zkapauthorizer/tests/test_client_resource.py
index 0bab6d2..430d81d 100644
--- a/src/_zkapauthorizer/tests/test_client_resource.py
+++ b/src/_zkapauthorizer/tests/test_client_resource.py
@@ -209,7 +209,7 @@ class ResourceTests(TestCase):
     """
     General tests for the resources exposed by the plugin.
     """
-    @given(tahoe_configs(), requests(just([u"zkap"]) | just([u"voucher"])))
+    @given(tahoe_configs(), requests(just([u"blinded-token"]) | just([u"voucher"])))
     def test_reachable(self, get_config, request):
         """
         A resource is reachable at a child of the resource returned by
@@ -224,19 +224,22 @@ class ResourceTests(TestCase):
         )
 
 
-class ZKAPTests(TestCase):
+class BlindedTokenTests(TestCase):
     """
-    Tests relating to ``/zkap`` as implemented by the
+    Tests relating to ``/blinded-token`` as implemented by the
     ``_zkapauthorizer.resource`` module.
     """
     def setUp(self):
-        super(ZKAPTests, self).setUp()
+        super(BlindedTokenTests, self).setUp()
         self.useFixture(CaptureTwistedLogs())
 
 
     @given(tahoe_configs())
     def test_get(self, get_config):
         """
+        When the blinded token collection receives a **GET**, the response is the
+        total number of blinded tokens in the system and the blinded tokens
+        themselves.
         """
         tempdir = self.useFixture(TempDir())
         config = get_config(tempdir.join(b"tahoe"), b"tub.port")
@@ -244,7 +247,7 @@ class ZKAPTests(TestCase):
         agent = RequestTraversalAgent(root)
         requesting = agent.request(
             b"GET",
-            b"http://127.0.0.1/zkap",
+            b"http://127.0.0.1/blinded-token",
         )
         self.addDetail(
             u"requesting result",
@@ -260,7 +263,7 @@ class ZKAPTests(TestCase):
                         succeeded(
                             Equals({
                                 u"total": 0,
-                                u"zkaps": [],
+                                u"blinded-tokens": [],
                             }),
                         )
                     ),
-- 
GitLab