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
cd21ccbe
Commit
cd21ccbe
authored
5 years ago
by
Jean-Paul Calderone
Browse files
Options
Downloads
Patches
Plain Diff
Replace "PRN" with "voucher".
parent
0ca5de27
No related branches found
No related tags found
1 merge request
!16
Rename "Payment Reference Numbers"
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/_secureaccesstokenauthorizer/resource.py
+6
-6
6 additions, 6 deletions
src/_secureaccesstokenauthorizer/resource.py
src/_secureaccesstokenauthorizer/tests/test_client_resource.py
+16
-15
16 additions, 15 deletions
...secureaccesstokenauthorizer/tests/test_client_resource.py
with
22 additions
and
21 deletions
src/_secureaccesstokenauthorizer/resource.py
+
6
−
6
View file @
cd21ccbe
...
...
@@ -79,11 +79,11 @@ def from_configuration(node_config, store=None):
class
_PaymentReferenceNumberCollection
(
Resource
):
"""
This class implements redemption of payment reference numbers
(PRNs).
Users
**PUT** such numbers to this resource which delegates redemption
This class implements redemption of payment reference numbers
. Users
**PUT** such numbers to this resource which delegates redemption
responsibilities to the redemption controller. Child resources of this
resource can also be retrieved to monitor the status of previously
submitted
PRN
s.
submitted
voucher
s.
"""
def
__init__
(
self
,
store
,
controller
):
self
.
_store
=
store
...
...
@@ -93,7 +93,7 @@ class _PaymentReferenceNumberCollection(Resource):
def
render_PUT
(
self
,
request
):
"""
Record a
PRN
and begin attempting to redeem it.
Record a
voucher
and begin attempting to redeem it.
"""
try
:
payload
=
loads
(
request
.
content
.
read
())
...
...
@@ -137,9 +137,9 @@ def is_syntactic_prn(prn):
:return bool: ``True`` if and only if ``prn`` is a unicode string
containing a syntactically valid payment reference number. This says
**nothing** about the validity of the represented
PRN
itself. A
**nothing** about the validity of the represented
voucher
itself. A
``True`` result only means the unicode string can be **interpreted**
as a
PRN
.
as a
voucher
.
"""
if
not
isinstance
(
prn
,
unicode
):
return
False
...
...
This diff is collapsed.
Click to expand it.
src/_secureaccesstokenauthorizer/tests/test_client_resource.py
+
16
−
15
View file @
cd21ccbe
...
...
@@ -147,9 +147,9 @@ def not_payment_reference_numbers():
),
),
payment_reference_numbers
().
map
(
# Turn a valid
PRN
into a
PRN
that is invalid only by
containing a
# character from the base64 alphabet in place of one
from the
# urlsafe-base64 alphabet.
# Turn a valid
voucher
into a
voucher
that is invalid only by
#
containing a
character from the base64 alphabet in place of one
#
from the
urlsafe-base64 alphabet.
lambda
prn
:
u
"
/
"
+
prn
[
1
:],
),
)
...
...
@@ -210,7 +210,7 @@ class PaymentReferenceNumberTests(TestCase):
"""
Tests relating to ``/payment-reference-number`` as implemented by the
``_secureaccesstokenauthorizer.resource`` module and its handling of
payment reference numbers
(PRNs)
.
payment reference numbers.
"""
def
setUp
(
self
):
super
(
PaymentReferenceNumberTests
,
self
).
setUp
()
...
...
@@ -235,9 +235,9 @@ class PaymentReferenceNumberTests(TestCase):
@given
(
tahoe_configs_with_client_config
,
payment_reference_numbers
())
def
test_put_prn
(
self
,
get_config
,
prn
):
"""
When a
PRN is sent in a
``PUT`` to ``PaymentReferenceNumberCollection`` it
is
passed in to the
PRN
redemption model object for handling and an
``OK``
response is returned.
When a
voucher is
``PUT`` to ``PaymentReferenceNumberCollection`` it
is
passed in to the redemption model object for handling and an
``OK``
response is returned.
"""
tempdir
=
self
.
useFixture
(
TempDir
())
config
=
get_config
(
tempdir
.
join
(
b
"
tahoe
"
),
b
"
tub.port
"
)
...
...
@@ -297,8 +297,9 @@ class PaymentReferenceNumberTests(TestCase):
@given
(
tahoe_configs_with_client_config
,
not_payment_reference_numbers
())
def
test_get_invalid_prn
(
self
,
get_config
,
not_prn
):
"""
When a syntactically invalid PRN is requested with a ``GET`` to a child of
``PaymentReferenceNumberCollection`` the response is **BAD REQUEST**.
When a syntactically invalid voucher is requested with a ``GET`` to a
child of ``PaymentReferenceNumberCollection`` the response is **BAD
REQUEST**.
"""
tempdir
=
self
.
useFixture
(
TempDir
())
config
=
get_config
(
tempdir
.
join
(
b
"
tahoe
"
),
b
"
tub.port
"
)
...
...
@@ -325,9 +326,9 @@ class PaymentReferenceNumberTests(TestCase):
@given
(
tahoe_configs_with_client_config
,
payment_reference_numbers
())
def
test_get_unknown_prn
(
self
,
get_config
,
prn
):
"""
When a
PRN
is requested with a ``GET`` to a child of
When a
voucher
is requested with a ``GET`` to a child of
``PaymentReferenceNumberCollection`` the response is **NOT FOUND** if
the
PRN
hasn
'
t previously been submitted with a ``PUT``.
the
voucher
hasn
'
t previously been submitted with a ``PUT``.
"""
tempdir
=
self
.
useFixture
(
TempDir
())
config
=
get_config
(
tempdir
.
join
(
b
"
tahoe
"
),
b
"
tub.port
"
)
...
...
@@ -348,9 +349,9 @@ class PaymentReferenceNumberTests(TestCase):
@given
(
tahoe_configs_with_client_config
,
payment_reference_numbers
())
def
test_get_known_prn
(
self
,
get_config
,
prn
):
"""
When a
PRN
is first ``PUT`` and then later a ``GET`` is issued for the
same
PRN
then the response code is **OK** and details about the
PRN
are included in a json-encoded response body.
When a
voucher
is first ``PUT`` and then later a ``GET`` is issued for the
same
voucher
then the response code is **OK** and details about the
voucher
are included in a json-encoded response body.
"""
tempdir
=
self
.
useFixture
(
TempDir
())
config
=
get_config
(
tempdir
.
join
(
b
"
tahoe
"
),
b
"
tub.port
"
)
...
...
@@ -416,7 +417,7 @@ class PaymentReferenceNumberTests(TestCase):
root
=
root_from_config
(
config
)
agent
=
RequestTraversalAgent
(
root
)
note
(
"
{}
PRN
s
"
.
format
(
len
(
prns
)))
note
(
"
{}
voucher
s
"
.
format
(
len
(
prns
)))
for
prn
in
prns
:
producer
=
FileBodyProducer
(
...
...
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