Skip to content
Snippets Groups Projects
Commit 015394a0 authored by Jean-Paul Calderone's avatar Jean-Paul Calderone
Browse files

Correct the implementation too - ZKAP to blinded token

parent 5780e726
No related branches found
No related tags found
1 merge request!59Unblinded token web interface
...@@ -78,8 +78,8 @@ def from_configuration(node_config, store, redeemer=None): ...@@ -78,8 +78,8 @@ def from_configuration(node_config, store, redeemer=None):
), ),
) )
root.putChild( root.putChild(
b"zkap", b"blinded-token",
_ZKAPCollection( _BlindedTokenCollection(
store, store,
controller, controller,
), ),
...@@ -96,10 +96,10 @@ def application_json(request): ...@@ -96,10 +96,10 @@ def application_json(request):
request.responseHeaders.setRawHeaders(u"content-type", [u"application/json"]) 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 This class implements inspection of blinded tokens. Users **GET** this
find out about ZKAPs in the system. resource to find out about blinded tokens in the system.
""" """
_log = Logger() _log = Logger()
...@@ -110,10 +110,10 @@ class _ZKAPCollection(Resource): ...@@ -110,10 +110,10 @@ class _ZKAPCollection(Resource):
def render_GET(self, request): def render_GET(self, request):
""" """
Retrieve some ZKAPs and associated informatin. Retrieve some blinded tokens and associated information.
""" """
application_json(request) application_json(request)
return dumps({u"total": 0, u"zkaps": []}) return dumps({u"total": 0, u"blinded-tokens": []})
......
...@@ -209,7 +209,7 @@ class ResourceTests(TestCase): ...@@ -209,7 +209,7 @@ class ResourceTests(TestCase):
""" """
General tests for the resources exposed by the plugin. 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): def test_reachable(self, get_config, request):
""" """
A resource is reachable at a child of the resource returned by A resource is reachable at a child of the resource returned by
...@@ -224,19 +224,22 @@ class ResourceTests(TestCase): ...@@ -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. ``_zkapauthorizer.resource`` module.
""" """
def setUp(self): def setUp(self):
super(ZKAPTests, self).setUp() super(BlindedTokenTests, self).setUp()
self.useFixture(CaptureTwistedLogs()) self.useFixture(CaptureTwistedLogs())
@given(tahoe_configs()) @given(tahoe_configs())
def test_get(self, get_config): 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()) tempdir = self.useFixture(TempDir())
config = get_config(tempdir.join(b"tahoe"), b"tub.port") config = get_config(tempdir.join(b"tahoe"), b"tub.port")
...@@ -244,7 +247,7 @@ class ZKAPTests(TestCase): ...@@ -244,7 +247,7 @@ class ZKAPTests(TestCase):
agent = RequestTraversalAgent(root) agent = RequestTraversalAgent(root)
requesting = agent.request( requesting = agent.request(
b"GET", b"GET",
b"http://127.0.0.1/zkap", b"http://127.0.0.1/blinded-token",
) )
self.addDetail( self.addDetail(
u"requesting result", u"requesting result",
...@@ -260,7 +263,7 @@ class ZKAPTests(TestCase): ...@@ -260,7 +263,7 @@ class ZKAPTests(TestCase):
succeeded( succeeded(
Equals({ Equals({
u"total": 0, u"total": 0,
u"zkaps": [], u"blinded-tokens": [],
}), }),
) )
), ),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment