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
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
52bd8bae
Unverified
Commit
52bd8bae
authored
5 years ago
by
Jean-Paul Calderone
Browse files
Options
Downloads
Patches
Plain Diff
Test the non-None case of lease maintenance spending activity API
parent
a1fedb6b
No related branches found
No related tags found
1 merge request
!81
Add web interface for lease maintenance activity monitoring
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/_zkapauthorizer/resource.py
+1
-1
1 addition, 1 deletion
src/_zkapauthorizer/resource.py
src/_zkapauthorizer/tests/test_client_resource.py
+44
-0
44 additions, 0 deletions
src/_zkapauthorizer/tests/test_client_resource.py
with
45 additions
and
1 deletion
src/_zkapauthorizer/resource.py
+
1
−
1
View file @
52bd8bae
...
...
@@ -162,7 +162,7 @@ class _UnblindedTokenCollection(Resource):
if
activity
is
None
:
return
activity
return
{
u
"
when
"
:
activity
.
finished
,
u
"
when
"
:
activity
.
finished
.
isoformat
()
,
u
"
count
"
:
activity
.
passes_required
,
}
...
...
This diff is collapsed.
Click to expand it.
src/_zkapauthorizer/tests/test_client_resource.py
+
44
−
0
View file @
52bd8bae
...
...
@@ -440,6 +440,50 @@ class UnblindedTokenTests(TestCase):
),
)
@given
(
tahoe_configs
(),
lists
(
lists
(
integers
(
min_value
=
0
),
min_size
=
1
,
),
),
datetimes
(),
)
def
test_latest_lease_maintenance_spending
(
self
,
get_config
,
size_observations
,
now
):
"""
The most recently completed record of lease maintenance spending activity
is reported in the response to a **GET** request.
"""
tempdir
=
self
.
useFixture
(
TempDir
())
config
=
get_config
(
tempdir
.
join
(
b
"
tahoe
"
),
b
"
tub.port
"
)
root
=
root_from_config
(
config
,
lambda
:
now
)
# Put some activity into it.
total
=
0
activity
=
root
.
store
.
start_lease_maintenance
()
for
sizes
in
size_observations
:
total
+=
sum
(
sizes
)
activity
.
observe
(
sizes
)
activity
.
finish
()
agent
=
RequestTraversalAgent
(
root
)
d
=
agent
.
request
(
b
"
GET
"
,
b
"
http://127.0.0.1/unblinded-token
"
,
)
d
.
addCallback
(
readBody
)
d
.
addCallback
(
lambda
body
:
loads
(
body
)[
u
"
lease-maintenance-spending
"
],
)
self
.
assertThat
(
d
,
succeeded
(
Equals
({
"
when
"
:
now
.
isoformat
(),
"
count
"
:
total
,
})),
)
def
succeeded_with_unblinded_tokens_with_matcher
(
all_token_count
,
...
...
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