Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
B
beem
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
Container Registry
Model registry
Operate
Environments
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
beem
Commits
809b7b23
Commit
809b7b23
authored
7 years ago
by
Holger Nahrstaedt
Browse files
Options
Downloads
Patches
Plain Diff
add unit tests for market
parent
f5bfccbf
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
beem/__init__.py
+2
-1
2 additions, 1 deletion
beem/__init__.py
tests/test_market.py
+66
-0
66 additions, 0 deletions
tests/test_market.py
with
68 additions
and
1 deletion
beem/__init__.py
+
2
−
1
View file @
809b7b23
...
@@ -16,5 +16,6 @@ __all__ = [
...
@@ -16,5 +16,6 @@ __all__ = [
"
vote
"
,
"
vote
"
,
"
message
"
,
"
message
"
,
"
comment
"
,
"
comment
"
,
"
discussions
"
"
discussions
"
,
"
witness
"
]
]
This diff is collapsed.
Click to expand it.
tests/test_market.py
0 → 100644
+
66
−
0
View file @
809b7b23
import
unittest
from
pprint
import
pprint
from
beem
import
Steem
from
beem.market
import
Market
from
beembase.operationids
import
getOperationNameForId
from
beem.instance
import
set_shared_steem_instance
wif
=
"
5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3
"
nodes
=
[
"
wss://steemd.pevo.science
"
,
"
wss://gtg.steem.house:8090
"
,
"
wss://rpc.steemliberator.com
"
,
"
wss://rpc.buildteam.io
"
,
"
wss://rpc.steemviz.com
"
,
"
wss://seed.bitcoiner.me
"
,
"
wss://node.steem.ws
"
,
"
wss://steemd.steemgigs.org
"
,
"
wss://steemd.steemit.com
"
,
"
wss://steemd.minnowsupportproject.org
"
]
class
Testcases
(
unittest
.
TestCase
):
def
__init__
(
self
,
*
args
,
**
kwargs
):
super
().
__init__
(
*
args
,
**
kwargs
)
self
.
bts
=
Steem
(
nodes
,
nobroadcast
=
True
,
keys
=
{
"
active
"
:
wif
},
)
# from getpass import getpass
# self.bts.wallet.unlock(getpass())
set_shared_steem_instance
(
self
.
bts
)
self
.
bts
.
set_default_account
(
"
test
"
)
def
test_buy
(
self
):
bts
=
self
.
bts
m
=
Market
(
steem_instance
=
bts
)
tx
=
m
.
buy
(
5
,
0.1
,
account
=
"
test
"
)
self
.
assertEqual
(
(
tx
[
"
operations
"
][
0
][
0
]),
"
limit_order_create
"
)
op
=
tx
[
"
operations
"
][
0
][
1
]
self
.
assertIn
(
"
test
"
,
op
[
"
owner
"
])
def
test_sell
(
self
):
bts
=
self
.
bts
m
=
Market
(
steem_instance
=
bts
)
tx
=
m
.
sell
(
5
,
0.1
,
account
=
"
test
"
)
self
.
assertEqual
(
(
tx
[
"
operations
"
][
0
][
0
]),
"
limit_order_create
"
)
op
=
tx
[
"
operations
"
][
0
][
1
]
self
.
assertIn
(
"
test
"
,
op
[
"
owner
"
])
def
test_cancel
(
self
):
bts
=
self
.
bts
m
=
Market
(
steem_instance
=
bts
)
tx
=
m
.
cancel
(
5
,
account
=
"
test
"
)
self
.
assertEqual
(
(
tx
[
"
operations
"
][
0
][
0
]),
"
limit_order_cancel
"
)
op
=
tx
[
"
operations
"
][
0
][
1
]
self
.
assertIn
(
"
test
"
,
op
[
"
owner
"
])
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