Skip to content

Commit

Permalink
darken
Browse files Browse the repository at this point in the history
  • Loading branch information
meejah committed Jun 4, 2022
1 parent f219e31 commit 830d58c
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 25 deletions.
6 changes: 5 additions & 1 deletion src/_zkapauthorizer/recover.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,11 @@ async def recover(
:param cursor: A database cursor which can be used to populate the
database with recovered state.
"""
if self._state.stage not in {RecoveryStages.inactive, RecoveryStages.download_failed, RecoveryStages.import_failed}:
if self._state.stage not in {
RecoveryStages.inactive,
RecoveryStages.download_failed,
RecoveryStages.import_failed,
}:
return

self._set_state(RecoveryState(stage=RecoveryStages.started))
Expand Down
52 changes: 28 additions & 24 deletions src/_zkapauthorizer/tests/test_client_resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -1056,18 +1056,20 @@ async def recover():
lambda messages: list(
loads(args[0]) for (args, kwargs) in messages
),
Equals([
{
"stage": "started",
"failure-reason": None,
},
# "our" downloader (above) doesn't set any downloading etc
# state-updates
{
"stage": "download_failed",
"failure-reason": "downloader fails",
},
]),
Equals(
[
{
"stage": "started",
"failure-reason": None,
},
# "our" downloader (above) doesn't set any downloading etc
# state-updates
{
"stage": "download_failed",
"failure-reason": "downloader fails",
},
]
),
)
),
)
Expand All @@ -1079,18 +1081,20 @@ async def recover():
lambda messages: list(
loads(args[0]) for (args, kwargs) in messages
),
Equals([
{
"stage": "started",
"failure-reason": None,
},
# "our" downloader (above) doesn't set any downloading etc
# state-updates
{
"stage": "succeeded",
"failure-reason": None,
},
]),
Equals(
[
{
"stage": "started",
"failure-reason": None,
},
# "our" downloader (above) doesn't set any downloading etc
# state-updates
{
"stage": "succeeded",
"failure-reason": None,
},
]
),
)
),
)
Expand Down

0 comments on commit 830d58c

Please sign in to comment.