Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
silkaj
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
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
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
clients
python
silkaj
Commits
b8bf6d51
Commit
b8bf6d51
authored
3 years ago
by
Moul
Browse files
Options
Downloads
Patches
Plain Diff
[mod]
#194
: tests: Use f-string
parent
5214297b
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!195
#194, #376: Use f-string and sys.exit()
Pipeline
#13768
passed
3 years ago
Stage: checks
Stage: tests
Stage: coverage
Stage: deploy
Changes
4
Pipelines
3
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
tests/test_checksum.py
+3
-3
3 additions, 3 deletions
tests/test_checksum.py
tests/test_crypto_tools.py
+1
-1
1 addition, 1 deletion
tests/test_crypto_tools.py
tests/test_tui.py
+4
-10
4 additions, 10 deletions
tests/test_tui.py
tests/test_verify_blocks.py
+2
-2
2 additions, 2 deletions
tests/test_verify_blocks.py
with
10 additions
and
16 deletions
tests/test_checksum.py
+
3
−
3
View file @
b8bf6d51
...
...
@@ -21,7 +21,7 @@ from silkaj.cli import cli
pubkey
=
"
3rp7ahDGeXqffBQTnENiXEFXYS7BRjYmS33NbgfCuDc8
"
checksum
=
"
DFQ
"
pubkey_checksum
=
pubkey
+
"
:
"
+
checksum
pubkey_checksum
=
f
"
{
pubkey
}
:
{
checksum
}
"
pubkey_seedhex_authfile
=
(
"
3bc6f2484e441e40562155235cdbd8ce04c25e7df35bf5f87c067bf239db8511
"
)
...
...
@@ -31,7 +31,7 @@ pubkey_seedhex_authfile = (
"
command, excepted_output
"
,
[
([
"
checksum
"
,
pubkey_checksum
],
"
The checksum is valid
"
),
([
"
checksum
"
,
pubkey
+
"
:vAK
"
],
"
The checksum is invalid
"
),
([
"
checksum
"
,
f
"
{
pubkey
}
:vAK
"
],
"
The checksum is invalid
"
),
([
"
checksum
"
,
pubkey
],
pubkey_checksum
),
([
"
checksum
"
,
"
uid
"
],
"
Error: Wrong public key format
"
),
([
"
checksum
"
],
MESSAGE
),
...
...
@@ -44,4 +44,4 @@ def test_checksum_command(command, excepted_output):
with
open
(
"
authfile
"
,
"
w
"
)
as
f
:
f
.
write
(
pubkey_seedhex_authfile
)
result
=
CliRunner
().
invoke
(
cli
,
args
=
command
)
assert
result
.
output
==
excepted_output
+
"
\n
"
assert
result
.
output
==
f
"
{
excepted_output
}
\n
"
This diff is collapsed.
Click to expand it.
tests/test_crypto_tools.py
+
1
−
1
View file @
b8bf6d51
...
...
@@ -42,7 +42,7 @@ def test_gen_checksum(pubkey, checksum):
],
)
def
test_validate_checksum
(
pubkey
,
checksum
,
expected
,
capsys
):
pubkey_with_ck
=
str
(
pubkey
+
"
:
"
+
checksum
)
pubkey_with_ck
=
f
"
{
pubkey
}
:
{
checksum
}
"
if
expected
==
None
:
assert
pubkey
==
crypto_tools
.
validate_checksum
(
pubkey_with_ck
)
else
:
...
...
This diff is collapsed.
Click to expand it.
tests/test_tui.py
+
4
−
10
View file @
b8bf6d51
...
...
@@ -30,14 +30,8 @@ def test_display_amount(message, amount, currency_symbol):
amount_UD
=
round
(
amount
/
mock_ud_value
,
2
)
expected
=
[
[
message
+
"
(unit|relative)
"
,
str
(
amount
/
100
)
+
"
"
+
currency_symbol
+
"
|
"
+
str
(
amount_UD
)
+
"
UD
"
+
currency_symbol
,
f
"
{
message
}
(unit|relative)
"
,
f
"
{
str
(
amount
/
100
)
}
{
currency_symbol
}
|
{
str
(
amount_UD
)
}
UD
{
currency_symbol
}
"
,
]
]
tx
=
list
()
...
...
@@ -56,9 +50,9 @@ def test_display_amount(message, amount, currency_symbol):
def
test_display_pubkey
(
message
,
pubkey
,
id
,
monkeypatch
):
monkeypatch
.
setattr
(
wot_tools
,
"
is_member
"
,
patched_is_member
)
expected
=
[[
message
+
"
(pubkey:checksum)
"
,
display_pubkey_and_checksum
(
pubkey
)]]
expected
=
[[
f
"
{
message
}
(pubkey:checksum)
"
,
display_pubkey_and_checksum
(
pubkey
)]]
if
id
:
expected
.
append
([
message
+
"
(id)
"
,
id
])
expected
.
append
([
f
"
{
message
}
(id)
"
,
id
])
tx
=
list
()
display_pubkey
(
tx
,
message
,
pubkey
)
assert
tx
==
expected
...
...
This diff is collapsed.
Click to expand it.
tests/test_verify_blocks.py
+
2
−
2
View file @
b8bf6d51
...
...
@@ -55,8 +55,8 @@ def test_check_passed_blocks_range(from_block, to_block, capsys, monkeypatch):
assert
pytest_wrapped_e
.
value
.
code
==
FAILURE_EXIT_STATUS
captured
=
capsys
.
readouterr
()
if
to_block
==
HEAD_BLOCK
+
1
:
expected
=
"
Passed TO_BLOCK argument is bigger than the head block:
"
+
str
(
HEAD_BLOCK
expected
=
(
f
"
Passed TO_BLOCK argument is bigger than the head block:
{
str
(
HEAD_BLOCK
)
}
"
)
else
:
expected
=
"
TO_BLOCK should be bigger or equal to FROM_BLOCK
\n
"
...
...
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