4
4
import test_tools as tt
5
5
6
6
from .local_tools import verify_json_patterns , verify_text_patterns
7
- from .....local_tools import create_account_and_fund_it
8
7
9
8
BALANCES = {
10
9
'alice' : {
11
- 'tests ' : tt .Asset .Test (100 ),
10
+ 'hives ' : tt .Asset .Test (100 ),
12
11
'vests' : tt .Asset .Test (110 ),
13
- 'tbds ' : tt .Asset .Tbd (120 ),
12
+ 'hbds ' : tt .Asset .Tbd (120 ),
14
13
},
15
14
'bob' : {
16
- 'tests ' : tt .Asset .Test (200 ),
15
+ 'hives ' : tt .Asset .Test (200 ),
17
16
'vests' : tt .Asset .Test (210 ),
18
- 'tbds ' : tt .Asset .Tbd (220 ),
17
+ 'hbds ' : tt .Asset .Tbd (220 ),
19
18
},
20
19
'carol' : {
21
- 'tests ' : tt .Asset .Test (300 ),
20
+ 'hives ' : tt .Asset .Test (300 ),
22
21
'vests' : tt .Asset .Test (310 ),
23
- 'tbds ' : tt .Asset .Tbd (320 ),
22
+ 'hbds ' : tt .Asset .Tbd (320 ),
24
23
}
25
24
}
26
25
27
26
TOTAL_BALANCES = {
28
- 'tests ' : sum ((balance ['tests ' ] for balance in BALANCES .values ()), start = tt .Asset .Test (0 )),
29
- 'tbds ' : sum ((balance ['tbds ' ] for balance in BALANCES .values ()), start = tt .Asset .Tbd (0 ))
27
+ 'hives ' : sum ((balance ['hives ' ] for balance in BALANCES .values ()), start = tt .Asset .Test (0 )),
28
+ 'hbds ' : sum ((balance ['hbds ' ] for balance in BALANCES .values ()), start = tt .Asset .Tbd (0 ))
30
29
}
31
30
32
31
33
32
def test_list_my_accounts_json_format (wallet_with_json_formatter ):
34
33
for name , balances in BALANCES .items ():
35
- create_account_and_fund_it ( wallet_with_json_formatter , name = name , ** balances )
34
+ wallet_with_json_formatter . create_account ( name = name , ** balances )
36
35
37
36
accounts_summary = wallet_with_json_formatter .api .list_my_accounts ()
38
37
for name , balances , returned_account in zip (BALANCES .keys (), BALANCES .values (), accounts_summary ['accounts' ]):
39
38
assert returned_account ['name' ] == name
40
- assert returned_account ['balance' ] == balances ['tests ' ].as_nai ()
41
- assert returned_account ['hbd_balance' ] == balances ['tbds ' ].as_nai ()
39
+ assert returned_account ['balance' ] == balances ['hives ' ].as_nai ()
40
+ assert returned_account ['hbd_balance' ] == balances ['hbds ' ].as_nai ()
42
41
43
- assert accounts_summary ['total_hive' ] == TOTAL_BALANCES ['tests ' ].as_nai ()
44
- assert accounts_summary ['total_hbd' ] == TOTAL_BALANCES ['tbds ' ].as_nai ()
42
+ assert accounts_summary ['total_hive' ] == TOTAL_BALANCES ['hives ' ].as_nai ()
43
+ assert accounts_summary ['total_hbd' ] == TOTAL_BALANCES ['hbds ' ].as_nai ()
45
44
46
45
47
46
def test_list_my_accounts_text_format (wallet_with_text_formatter ):
48
47
for name , balances in BALANCES .items ():
49
- create_account_and_fund_it ( wallet_with_text_formatter , name = name , ** balances )
48
+ wallet_with_text_formatter . create_account ( name = name , ** balances )
50
49
51
50
accounts_summary = parse_text_response (wallet_with_text_formatter .api .list_my_accounts ())
52
51
53
52
for name , balances , returned_account in zip (BALANCES .keys (), BALANCES .values (), accounts_summary ['accounts' ]):
54
53
assert returned_account ['name' ] == name
55
- assert returned_account ['balance' ] == balances ['tests ' ]
56
- assert returned_account ['hbd_balance' ] == balances ['tbds ' ]
54
+ assert returned_account ['balance' ] == balances ['hives ' ]
55
+ assert returned_account ['hbd_balance' ] == balances ['hbds ' ]
57
56
58
- assert accounts_summary ['total_hive' ] == TOTAL_BALANCES ['tests ' ]
59
- assert accounts_summary ['total_hbd' ] == TOTAL_BALANCES ['tbds ' ]
57
+ assert accounts_summary ['total_hive' ] == TOTAL_BALANCES ['hives ' ]
58
+ assert accounts_summary ['total_hbd' ] == TOTAL_BALANCES ['hbds ' ]
60
59
61
60
62
61
def test_list_my_accounts_json_format_pattern_comparison (wallet_with_json_formatter ):
63
62
for name , balances in BALANCES .items ():
64
- create_account_and_fund_it ( wallet_with_json_formatter , name = name , ** balances )
63
+ wallet_with_json_formatter . create_account ( name = name , ** balances )
65
64
66
65
accounts_summary = wallet_with_json_formatter .api .list_my_accounts ()
67
66
@@ -70,7 +69,7 @@ def test_list_my_accounts_json_format_pattern_comparison(wallet_with_json_format
70
69
71
70
def test_list_my_accounts_text_format_pattern_comparison (wallet_with_text_formatter ):
72
71
for name , balances in BALANCES .items ():
73
- create_account_and_fund_it ( wallet_with_text_formatter , name = name , ** balances )
72
+ wallet_with_text_formatter . create_account ( name = name , ** balances )
74
73
75
74
accounts_summary = wallet_with_text_formatter .api .list_my_accounts ()
76
75
0 commit comments