Skip to content
Snippets Groups Projects
Commit 809b7b23 authored by Holger Nahrstaedt's avatar Holger Nahrstaedt
Browse files

add unit tests for market

parent f5bfccbf
No related branches found
No related tags found
No related merge requests found
...@@ -16,5 +16,6 @@ __all__ = [ ...@@ -16,5 +16,6 @@ __all__ = [
"vote", "vote",
"message", "message",
"comment", "comment",
"discussions" "discussions",
"witness"
] ]
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"])
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment