Skip to content

Commit

Permalink
Merge branch 'testsuite'
Browse files Browse the repository at this point in the history
  • Loading branch information
mikakoi committed May 14, 2018
2 parents 5abcd69 + 43989ad commit baf6fd7
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 1 deletion.
2 changes: 1 addition & 1 deletion dexbot/__init__.py
Expand Up @@ -3,7 +3,7 @@
from appdirs import user_config_dir

APP_NAME = "dexbot"
VERSION = '0.1.25'
VERSION = '0.1.26'
AUTHOR = "codaone"
__version__ = VERSION

Expand Down
52 changes: 52 additions & 0 deletions tests/test.py
@@ -0,0 +1,52 @@
#!/usr/bin/python3
import threading
import unittest
import logging
import time
import os

from dexbot.worker import WorkerInfrastructure

from bitshares.bitshares import BitShares

logging.basicConfig(
level=logging.INFO,
format='%(asctime)s %(levelname)s %(message)s'
)


TEST_CONFIG = {
'node': 'wss://node.testnet.bitshares.eu',
'bots': {
'echo':
{
'account': 'aud.bot.test4',
'market': 'TESTUSD:TEST',
'module': 'dexbot.strategies.echo'
}
}
}

# User needs to put a key in
KEYS = [os.environ['DEXBOT_TEST_WIF']]


class TestDexbot(unittest.TestCase):

def test_dexbot(self):
bitshares_instance = BitShares(node=TEST_CONFIG['node'], keys=KEYS)
worker_infrastructure = WorkerInfrastructure(config=TEST_CONFIG,
bitshares_instance=bitshares_instance)

def wait_then_stop():
time.sleep(20)
worker_infrastructure.do_next_tick(worker_infrastructure.stop)

stopper = threading.Thread(target=wait_then_stop)
stopper.start()
worker_infrastructure.run()
stopper.join()


if __name__ == '__main__':
unittest.main()

0 comments on commit baf6fd7

Please sign in to comment.