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
78574a8e
Commit
78574a8e
authored
5 years ago
by
Moul
Browse files
Options
Downloads
Patches
Plain Diff
[test]
#235
: tx: Add tests to check passed options for the amount of the tx
parent
1aa09de8
No related branches found
No related tags found
1 merge request
!146
Merge dev into master branch to complete v0.8.0 development cycle
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/test_tx.py
+36
-0
36 additions, 0 deletions
tests/test_tx.py
with
36 additions
and
0 deletions
tests/test_tx.py
+
36
−
0
View file @
78574a8e
import
pytest
import
pytest
from
click.testing
import
CliRunner
from
silkaj.tx
import
transaction_amount
from
silkaj.tx
import
transaction_amount
from
silkaj.money
import
UDValue
from
silkaj.money
import
UDValue
from
silkaj.cli
import
cli
@pytest.mark.asyncio
@pytest.mark.asyncio
...
@@ -17,3 +19,37 @@ async def test_transaction_amount():
...
@@ -17,3 +19,37 @@ async def test_transaction_amount():
assert
await
transaction_amount
(
None
,
1.9
,
None
)
==
round
(
1.9
*
ud_value
)
assert
await
transaction_amount
(
None
,
1.9
,
None
)
==
round
(
1.9
*
ud_value
)
assert
await
transaction_amount
(
None
,
1.0001
,
None
)
==
round
(
1.0001
*
ud_value
)
assert
await
transaction_amount
(
None
,
1.0001
,
None
)
==
round
(
1.0001
*
ud_value
)
assert
await
transaction_amount
(
None
,
9.9999
,
None
)
==
round
(
9.9999
*
ud_value
)
assert
await
transaction_amount
(
None
,
9.9999
,
None
)
==
round
(
9.9999
*
ud_value
)
def
test_tx_passed_amount_cli
():
"""
One option
"""
result
=
CliRunner
().
invoke
(
cli
,
[
"
tx
"
,
"
--amount
"
,
"
1
"
])
assert
"
Error: Missing option
"
in
result
.
output
assert
result
.
exit_code
==
2
result
=
CliRunner
().
invoke
(
cli
,
[
"
tx
"
,
"
--amountUD
"
,
"
1
"
])
assert
"
Error: Missing option
"
in
result
.
output
assert
result
.
exit_code
==
2
result
=
CliRunner
().
invoke
(
cli
,
[
"
tx
"
,
"
--allSources
"
])
assert
"
Error: Missing option
"
in
result
.
output
assert
result
.
exit_code
==
2
"""
Multiple options
"""
result
=
CliRunner
().
invoke
(
cli
,
[
"
tx
"
,
"
--amount
"
,
1
,
"
--amountUD
"
,
1
])
assert
"
Error: Usage
"
in
result
.
output
assert
result
.
exit_code
==
2
result
=
CliRunner
().
invoke
(
cli
,
[
"
tx
"
,
"
--amount
"
,
1
,
"
--allSources
"
])
assert
"
Error: Usage
"
in
result
.
output
assert
result
.
exit_code
==
2
result
=
CliRunner
().
invoke
(
cli
,
[
"
tx
"
,
"
--amountUD
"
,
1
,
"
--allSources
"
])
assert
"
Error: Usage
"
in
result
.
output
assert
result
.
exit_code
==
2
result
=
CliRunner
().
invoke
(
cli
,
[
"
tx
"
,
"
--amount
"
,
1
,
"
--amountUD
"
,
1
,
"
--allSources
"
]
)
assert
"
Error: Usage
"
in
result
.
output
assert
result
.
exit_code
==
2
This diff is collapsed.
Click to expand it.
Moul
@moul
mentioned in merge request
!108 (merged)
·
5 years ago
mentioned in merge request
!108 (merged)
mentioned in merge request !108
Toggle commit list
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