Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Z
ZKAPAuthorizer
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Administrator
ZKAPAuthorizer
Commits
015394a0
Commit
015394a0
authored
5 years ago
by
Jean-Paul Calderone
Browse files
Options
Downloads
Patches
Plain Diff
Correct the implementation too - ZKAP to blinded token
parent
5780e726
No related branches found
No related tags found
1 merge request
!59
Unblinded token web interface
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/_zkapauthorizer/resource.py
+7
-7
7 additions, 7 deletions
src/_zkapauthorizer/resource.py
src/_zkapauthorizer/tests/test_client_resource.py
+9
-6
9 additions, 6 deletions
src/_zkapauthorizer/tests/test_client_resource.py
with
16 additions
and
13 deletions
src/_zkapauthorizer/resource.py
+
7
−
7
View file @
015394a0
...
@@ -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
"
,
_
ZKAP
Collection
(
_
BlindedToken
Collection
(
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
_
ZKAP
Collection
(
Resource
):
class
_
BlindedToken
Collection
(
Resource
):
"""
"""
This class implements inspection of
ZKAP
s. Users **GET** this
resource to
This class implements inspection of
blinded token
s. Users **GET** this
find out about
ZKAP
s in the system.
resource to
find out about
blinded token
s 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
ZKAP
s and associated informatin.
Retrieve some
blinded token
s and associated informati
o
n.
"""
"""
application_json
(
request
)
application_json
(
request
)
return
dumps
({
u
"
total
"
:
0
,
u
"
zkap
s
"
:
[]})
return
dumps
({
u
"
total
"
:
0
,
u
"
blinded-token
s
"
:
[]})
...
...
This diff is collapsed.
Click to expand it.
src/_zkapauthorizer/tests/test_client_resource.py
+
9
−
6
View file @
015394a0
...
@@ -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
ZKAP
Tests
(
TestCase
):
class
BlindedToken
Tests
(
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
(
ZKAP
Tests
,
self
).
setUp
()
super
(
BlindedToken
Tests
,
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
"
zkap
s
"
:
[],
u
"
blinded-token
s
"
:
[],
}),
}),
)
)
),
),
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment