77from bitshares .asset import Asset
88from bitshares .instance import set_shared_bitshares_instance
99from bitsharesbase .operationids import getOperationNameForId
10-
11- wif = "5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3"
10+ from .fixtures import fixture_data , bitshares
1211
1312
1413class Testcases (unittest .TestCase ):
1514
16- def __init__ (self , * args , ** kwargs ):
17- super ().__init__ (* args , ** kwargs )
18-
19- self .bts = BitShares (
20- "wss://node.testnet.bitshares.eu" ,
21- nobroadcast = True ,
22- # We want to bundle many operations into a single transaction
23- bundle = True ,
24- # Overwrite wallet to use this list of wifs only
25- wif = {"active" : wif }
26- )
27- self .bts .set_default_account ("init0" )
28- set_shared_bitshares_instance (self .bts )
15+ def setUp (self ):
16+ fixture_data ()
2917
3018 def test_account (self ):
31- Account ("witness-account " )
19+ Account ("init0 " )
3220 Account ("1.2.3" )
33- asset = Asset ("1.3.0" )
34- symbol = asset ["symbol" ]
35- account = Account ("witness-account" , full = True )
36- self .assertEqual (account .name , "witness-account" )
21+ account = Account ("init0" , full = True )
22+ self .assertEqual (account .name , "init0" )
3723 self .assertEqual (account ["name" ], account .name )
38- self .assertEqual (account ["id" ], "1.2.1 " )
24+ self .assertEqual (account ["id" ], "1.2.100 " )
3925 self .assertIsInstance (account .balance ("1.3.0" ), Amount )
4026 # self.assertIsInstance(account.balance({"symbol": symbol}), Amount)
4127 self .assertIsInstance (account .balances , list )
@@ -48,39 +34,32 @@ def test_account(self):
4834 account .cached = False
4935 self .assertIn ("id" , account )
5036 account .cached = False
51- self .assertEqual (account ["id" ], "1.2.1 " )
52- self .assertEqual (str (account ), "<Account 1.2.1 >" )
37+ self .assertEqual (account ["id" ], "1.2.90742 " )
38+ self .assertEqual (str (account ), "<Account 1.2.90742 >" )
5339 self .assertIsInstance (Account (account ), Account )
5440
5541 def test_account_upgrade (self ):
56- account = Account ("witness-account" )
42+ account = Account ("init0" )
43+ pprint (account )
5744 tx = account .upgrade ()
5845 ops = tx ["operations" ]
5946 op = ops [0 ][1 ]
6047 self .assertEqual (len (ops ), 1 )
61- self .assertEqual (
62- getOperationNameForId (ops [0 ][0 ]),
63- "account_upgrade"
64- )
65- self .assertTrue (
66- op ["upgrade_to_lifetime_member" ]
67- )
68- self .assertEqual (
69- op ["account_to_upgrade" ],
70- "1.2.1" ,
71- )
48+ self .assertEqual (getOperationNameForId (ops [0 ][0 ]), "account_upgrade" )
49+ self .assertTrue (op ["upgrade_to_lifetime_member" ])
50+ self .assertEqual (op ["account_to_upgrade" ], "1.2.100" )
7251
7352 def test_openorders (self ):
74- account = Account ("witness-account " )
53+ account = Account ("init0 " )
7554 self .assertIsInstance (account .openorders , list )
7655
7756 def test_calls (self ):
78- account = Account ("witness-account " )
57+ account = Account ("init0 " )
7958 self .assertIsInstance (account .callpositions , dict )
8059
8160 def test_whitelist (self ):
8261 from bitsharesbase .operations import Account_whitelist
83- account = Account ("witness-account " )
62+ account = Account ("init0 " )
8463 tx = account .whitelist ("committee-account" )
8564 self .assertEqual (len (tx ["operations" ]), 1 )
8665 self .assertEqual (tx ["operations" ][0 ][0 ], 7 )
@@ -89,7 +68,7 @@ def test_whitelist(self):
8968
9069 def test_blacklist (self ):
9170 from bitsharesbase .operations import Account_whitelist
92- account = Account ("witness-account " )
71+ account = Account ("init0 " )
9372 tx = account .blacklist ("committee-account" )
9473 self .assertEqual (len (tx ["operations" ]), 1 )
9574 self .assertEqual (tx ["operations" ][0 ][0 ], 7 )
@@ -98,7 +77,7 @@ def test_blacklist(self):
9877
9978 def test_unlist (self ):
10079 from bitsharesbase .operations import Account_whitelist
101- account = Account ("witness-account " )
80+ account = Account ("init0 " )
10281 tx = account .nolist ("committee-account" )
10382 self .assertEqual (len (tx ["operations" ]), 1 )
10483 self .assertEqual (tx ["operations" ][0 ][0 ], 7 )
@@ -110,13 +89,13 @@ def test_accountupdate(self):
11089 t = {'id' : '2.6.29' ,
11190 'lifetime_fees_paid' : '44261516129' ,
11291 'most_recent_op' : '2.9.0' ,
113- 'owner' : '1.2.29 ' ,
92+ 'owner' : '1.2.100 ' ,
11493 'pending_fees' : 0 ,
11594 'pending_vested_fees' : 16310 ,
11695 'total_core_in_orders' : '6788845277634' ,
11796 'total_ops' : 0 }
11897 update = AccountUpdate (t )
119- self .assertEqual (update ["owner" ], "1.2.29 " )
98+ self .assertEqual (update ["owner" ], "1.2.100 " )
12099 self .assertIsInstance (update .account , Account )
121100 update .__repr__ ()
122101
0 commit comments