Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
HELpy
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
Container 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
Show more breadcrumbs
hive
HELpy
Commits
6dbc4480
Commit
6dbc4480
authored
2 months ago
by
Krzysztof Mochocki
Browse files
Options
Downloads
Patches
Plain Diff
Fix regex for wallet path detection
parent
82459983
No related branches found
No related tags found
1 merge request
!74
Fix regex for wallet path detection
Pipeline
#115752
passed
2 months ago
Stage: static_code_analysis
Stage: build
Stage: helpy
Stage: beekeepy
Changes
2
Pipelines
3
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
helpy/helpy/_communication/rules.py
+7
-5
7 additions, 5 deletions
helpy/helpy/_communication/rules.py
tests/beekeepy_test/handle/api_tests/test_api_unlock.py
+1
-1
1 addition, 1 deletion
tests/beekeepy_test/handle/api_tests/test_api_unlock.py
with
8 additions
and
6 deletions
helpy/helpy/_communication/rules.py
+
7
−
5
View file @
6dbc4480
...
...
@@ -27,6 +27,9 @@ if TYPE_CHECKING:
from
helpy.exceptions
import
OverseerError
REGEX_FOR_PATH_WITH_CAPTURE_GROUP_ON_WALLET_NAME
:
Final
[
str
]
=
r
"
\/(?:(?:[^\/]+\/)+)([^\/]+)\.wallet
"
class
UnableToAcquireDatabaseLock
(
OverseerRule
):
LOOKUP_MESSAGE
:
ClassVar
[
str
]
=
"
Unable to acquire database lock
"
...
...
@@ -236,7 +239,7 @@ class WalletIsAlreadyUnlocked(OverseerRule):
class
UnableToOpenWallet
(
OverseerRule
):
_UNABLE_TO_OPEN_WALLET_REGEX
:
ClassVar
[
re
.
Pattern
[
str
]]
=
re
.
compile
(
r
"
Assert Exception:_new_item->load_wallet_file\(\):
"
r
"
Unable to open file:
(?:\/[\w-]+)+\/([\w-]+\.wallet)
(?:rethrow)?
"
r
"
Unable to open file:
"
+
REGEX_FOR_PATH_WITH_CAPTURE_GROUP_ON_WALLET_NAME
+
r
"
(?:rethrow)?
"
)
def
_check_single
(
self
,
parsed_response
:
Json
,
whole_response
:
Json
|
list
[
Json
])
->
list
[
OverseerError
]:
...
...
@@ -253,12 +256,11 @@ class UnableToOpenWallet(OverseerRule):
return
[]
#
class
InvalidPassword
(
OverseerRule
):
_INVALID_PASSWORD_REGEX
:
ClassVar
[
re
.
Pattern
[
str
]]
=
re
.
compile
(
r
"
Assert Exception:false: Invalid password for wallet: (?:\/[\w-]+)+\/([\w-]+\.wallet)(?:rethrow)?
"
r
"
Assert Exception:false: Invalid password for wallet:
"
+
REGEX_FOR_PATH_WITH_CAPTURE_GROUP_ON_WALLET_NAME
+
r
"
(?:rethrow)?
"
)
def
_check_single
(
self
,
parsed_response
:
Json
,
whole_response
:
Json
|
list
[
Json
])
->
list
[
OverseerError
]:
...
...
This diff is collapsed.
Click to expand it.
tests/beekeepy_test/handle/api_tests/test_api_unlock.py
+
1
−
1
View file @
6dbc4480
...
...
@@ -86,5 +86,5 @@ def test_api_unlock_with_invalid_password(beekeeper: Beekeeper, setup_wallets: W
wallet
=
setup_wallets
(
1
,
keys_per_wallet
=
0
)[
0
]
# ASSERT
with
pytest
.
raises
(
InvalidPasswordError
,
match
=
"
Invalid password for wallet: wallet-0
.wallet
"
):
with
pytest
.
raises
(
InvalidPasswordError
,
match
=
"
Invalid password for wallet: wallet-0
"
):
beekeeper
.
api
.
unlock
(
wallet_name
=
wallet
.
name
,
password
=
"
invalid password
"
)
# noqa: S106
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