Skip to content

Commit

Permalink
fix: unitests now working
Browse files Browse the repository at this point in the history
  • Loading branch information
xeroc committed May 13, 2022
1 parent 16b6dfb commit 77716a6
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 17 deletions.
4 changes: 4 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ classifiers =
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8
Topic :: Software Development :: Version Control :: Git

[options]
python_requires = >= 3.6
packages = find:
Expand All @@ -35,6 +36,9 @@ setup_requires =
[aliases]
test=pytest

[tool:pytest]
addopts = --ignore-glob=*/aio/*

[coverage:run]
source=bitsharesbase,bitsharesapi,bitshares
omit=
Expand Down
2 changes: 1 addition & 1 deletion tests/fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

# bitshares instance
bitshares = BitShares(
"wss://bitshares.openledger.info/ws", keys=wifs, nobroadcast=True, num_retries=1
"wss://eu.nodes.bitshares.ws", keys=wifs, nobroadcast=True, num_retries=1
)
config = bitshares.config

Expand Down
15 changes: 6 additions & 9 deletions tests/test_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,14 @@


class Testcases(unittest.TestCase):
def test_bts1bts2(self):
b1 = BitShares("wss://node.testnet.bitshares.eu", nobroadcast=True)

b2 = BitShares("wss://node.bitshares.eu", nobroadcast=True)

self.assertNotEqual(b1.rpc.url, b2.rpc.url)

def test_default_connection(self):
b1 = BitShares("wss://node.testnet.bitshares.eu", nobroadcast=True)
b1 = BitShares("wss://eu.nodes.bitshares.ws", nobroadcast=True)
set_shared_bitshares_instance(b1)
test = Asset("1.3.0", blockchain_instance=b1)
# Needed to clear cache
test.refresh()

"""
b2 = BitShares("wss://node.bitshares.eu", nobroadcast=True)
set_shared_bitshares_instance(b2)
bts = Asset("1.3.0", blockchain_instance=b2)
Expand All @@ -33,15 +27,18 @@ def test_default_connection(self):
self.assertEqual(test["symbol"], "TEST")
self.assertEqual(bts["symbol"], "BTS")
"""

def test_default_connection2(self):
b1 = BitShares("wss://node.testnet.bitshares.eu", nobroadcast=True)
b1 = BitShares("wss://eu.nodes.bitshares.ws", nobroadcast=True)
test = Asset("1.3.0", blockchain_instance=b1)
test.refresh()

"""
b2 = BitShares("wss://node.bitshares.eu", nobroadcast=True)
bts = Asset("1.3.0", blockchain_instance=b2)
bts.refresh()
self.assertEqual(test["symbol"], "TEST")
self.assertEqual(bts["symbol"], "BTS")
"""
6 changes: 4 additions & 2 deletions tests/test_objectcache.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,14 @@ class Testcases(unittest.TestCase):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)

self.bts = BitShares(nobroadcast=True,)
self.bts = BitShares(
nobroadcast=True,
)
set_shared_bitshares_instance(self.bts)

def test_cache(self):
cache = ObjectCache(default_expiration=1)
self.assertEqual(str(cache), "ObjectCache(n=0, default_expiration=1)")
self.assertEqual(str(cache), "ObjectCacheInMemory(default_expiration=1)")

# Data
cache["foo"] = "bar"
Expand Down
6 changes: 1 addition & 5 deletions tests/test_price.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,10 @@
from bitshares.price import Price
from bitshares.asset import Asset
import unittest
from .fixtures import bitshares


class Testcases(unittest.TestCase):
def __init__(self, *args, **kwargs):
super(Testcases, self).__init__(*args, **kwargs)
bitshares = BitShares("wss://node.bitshares.eu", nobroadcast=True,)
set_shared_bitshares_instance(bitshares)

def test_init(self):
# self.assertEqual(1, 1)

Expand Down

0 comments on commit 77716a6

Please sign in to comment.