Skip to content

Commit d58ad3b

Browse files
pi314xxeroc
authored andcommitted
Update test_transactions.py
9/11 tests ok
1 parent 208df71 commit d58ad3b

1 file changed

Lines changed: 78 additions & 75 deletions

File tree

tests/test_transactions.py

Lines changed: 78 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -1045,54 +1045,22 @@ def test_assert_b(self):
10451045
)
10461046
self.doit(0)
10471047

1048-
def compareConstructedTX(self):
1049-
self.maxDiff = None
1050-
self.op = operations.Call_order_update(
1051-
**{
1052-
"fee": {"amount": 100, "asset_id": "1.3.0"},
1053-
"delta_debt": {"amount": 10000, "asset_id": "1.3.22"},
1054-
"delta_collateral": {"amount": 100000000, "asset_id": "1.3.0"},
1055-
"funding_account": "1.2.29",
1056-
"extensions": {"target_collateral_ratio": 12345},
1057-
}
1058-
)
1059-
ops = [Operation(self.op)]
1060-
tx = Signed_Transaction(
1061-
ref_block_num=ref_block_num,
1062-
ref_block_prefix=ref_block_prefix,
1063-
expiration=expiration,
1064-
operations=ops,
1065-
)
1066-
tx = tx.sign([wif], chain=prefix)
1067-
tx.verify([PrivateKey(wif).pubkey], prefix)
1068-
txWire = hexlify(bytes(tx)).decode("ascii")
1069-
print("=" * 80)
1070-
pprint(tx.json())
1071-
print("=" * 80)
1072-
1073-
# Test against Bitshares backened
1074-
self.cm = bitshares.rpc.get_transaction_hex(tx.json())
1075-
1076-
print("soll: %s" % self.cm[:-130])
1077-
print("ist: %s" % txWire[:-130])
1078-
print(txWire[:-130] == self.cm[:-130])
1079-
self.assertEqual(self.cm[:-130], txWire[:-130])
10801048

1081-
def test_samet_fund_create(self):
1049+
def test_samet_fund_create(self):
10821050
self.op = operations.Samet_fund_create(
10831051
**{
10841052
"fee": {"amount": 0, "asset_id": "1.3.0"},
1085-
"owner_account": "1.2.123",
1053+
"owner_account": "1.2.310",
10861054
"asset_type": "1.3.0",
10871055
"balance": 10000,
10881056
"fee_rate": 1,
10891057
"extensions": [],
10901058
}
10911059
)
1092-
self.cm = ()
1093-
self.doit(1)
1094-
1095-
1060+
self.cm = ('f68585abf4dce7c804570140000000000000000000b60200102700000000000001000000000001203431966ca7e7f40e921633cd767eece0ddefc5abb5224965cca6458dfa28572b687c459a2f4189bf1a41e13336fac6db10cc8c90215888948453b5063a8ccb9f')
1061+
self.doit()
1062+
1063+
10961064
def test_samet_fund_delete(self):
10971065
self.op = operations.Samet_fund_delete(
10981066
**{
@@ -1102,10 +1070,10 @@ def test_samet_fund_delete(self):
11021070
"extensions": [],
11031071
}
11041072
)
1105-
self.cm = ()
1106-
self.doit(1)
1107-
1108-
1073+
self.cm = ('f68585abf4dce7c8045701410000000000000000007b010000011f4abefaf5a630eace47f6db44d6516c4e459e70cd89ba5988586d04be40646cf3723cf4b5979e5d094b819f94c37d19e4fac5a0aa20ba3ff8dab8d8482b5356d8')
1074+
self.doit()
1075+
1076+
11091077
def test_samet_fund_update(self):
11101078
self.op = operations.Samet_fund_update(
11111079
**{
@@ -1117,10 +1085,10 @@ def test_samet_fund_update(self):
11171085
"extensions": [],
11181086
}
11191087
)
1120-
self.cm = ()
1121-
self.doit(1)
1122-
1123-
1088+
self.cm = ('f68585abf4dce7c8045701420000000000000000007b010001020000000000011f08656f260d4e4c6580202ab2520cad06cdc2539f03c3a74bcc3b6a8cdf2da5f84b252f09f15b77e825f5bb3fe7ff70a28d48516160653318beda6e156ba47987')
1089+
self.doit()
1090+
1091+
11241092
def test_samet_fund_borrow(self):
11251093
self.op = operations.Samet_fund_borrow(
11261094
**{
@@ -1131,10 +1099,10 @@ def test_samet_fund_borrow(self):
11311099
"extensions": [],
11321100
}
11331101
)
1134-
self.cm = ()
1135-
self.doit(1)
1136-
1137-
1102+
self.cm = ('f68585abf4dce7c8045701430000000000000000007b010a00000000000000000000012007d969d65e15f9bb2c227fdd1baf74fbb0ce3e9ef197b386098188a78c5a1b992a1d7da0d39a91fb862536b53d719f02d88657cb21ae1c2ab55222d4814a893d')
1103+
self.doit()
1104+
1105+
11381106
def test_samet_fund_repay(self):
11391107
self.op = operations.Samet_fund_repay(
11401108
**{
@@ -1146,10 +1114,10 @@ def test_samet_fund_repay(self):
11461114
"extensions": [],
11471115
}
11481116
)
1149-
self.cm = ()
1150-
self.doit(1)
1151-
1152-
1117+
self.cm = ('f68585abf4dce7c8045701440000000000000000007b010a00000000000000000a00000000000000000000011f573766a5dfe79df21d82df4a858a032d083e7b5db8f1d10cf6c0f48967965190607170df053d90fdf46f6fe1d10e160d292de03697136f91865588718a272e88')
1118+
self.doit()
1119+
1120+
11531121
def test_credit_offer_create(self):
11541122
self.op = operations.Credit_offer_create(
11551123
**{
@@ -1160,12 +1128,12 @@ def test_credit_offer_create(self):
11601128
"fee_rate": 1,
11611129
"max_duration_seconds": 10000,
11621130
"min_deal_amount": 1000,
1163-
"enabled": True,
1131+
"enabled": False,
11641132
"auto_disable_time": 1000,
11651133
"acceptable_collateral":
11661134
[0,
11671135
{
1168-
"asset": "1.2.1"
1136+
"asset": "1.3.0"
11691137
}
11701138
],
11711139
"acceptable_borrowers":
@@ -1179,8 +1147,8 @@ def test_credit_offer_create(self):
11791147
)
11801148
self.cm = ()
11811149
self.doit(1)
1182-
1183-
1150+
1151+
11841152
def test_credit_offer_delete(self):
11851153
self.op = operations.Credit_offer_delete(
11861154
**{
@@ -1190,10 +1158,10 @@ def test_credit_offer_delete(self):
11901158
"extensions": [],
11911159
}
11921160
)
1193-
self.cm = ()
1194-
self.doit(1)
1195-
1196-
1161+
self.cm = ('f68585abf4dce7c8045701460000000000000000007b010000012042aed7548e971617836c55d55c57b5ecd15e2ef8ed1cdf56c380891ce10e2aaa743e3665de606a7833145a1a2dbe5b60870396972e9e5c803040ee4cec8a8772')
1162+
self.doit()
1163+
1164+
11971165
def test_credit_offer_update(self):
11981166
self.op = operations.Credit_offer_update(
11991167
**{
@@ -1209,7 +1177,7 @@ def test_credit_offer_update(self):
12091177
"acceptable_collateral":
12101178
[0,
12111179
{
1212-
"asset": "1.2.1"
1180+
"asset": "1.3.0"
12131181
}
12141182
],
12151183
"acceptable_borrowers":
@@ -1223,8 +1191,8 @@ def test_credit_offer_update(self):
12231191
)
12241192
self.cm = ()
12251193
self.doit(1)
1226-
1227-
1194+
1195+
12281196
def test_credit_offer_accept(self):
12291197
self.op = operations.Credit_offer_accept(
12301198
**{
@@ -1238,10 +1206,10 @@ def test_credit_offer_accept(self):
12381206
"extensions": [],
12391207
}
12401208
)
1241-
self.cm = ()
1242-
self.doit(1)
1243-
1244-
1209+
self.cm = ('f68585abf4dce7c8045701480000000000000000007b0100000000000000000000000000000000000001000000e8030000000001201dda600d9efc172ee7e0ca6a2b1279709184d0bb0960afd93b49f60f8d90caed6b0f84de19ee54d7434ee11ec0af1f45415f4b024adbf0ca59a9e167eab3901b')
1210+
self.doit()
1211+
1212+
12451213
def test_credit_deal_repay(self):
12461214
self.op = operations.Credit_deal_repay(
12471215
**{
@@ -1253,10 +1221,10 @@ def test_credit_deal_repay(self):
12531221
"extensions": [],
12541222
}
12551223
)
1256-
self.cm = ()
1257-
self.doit(1)
1258-
1259-
1224+
self.cm = ('f68585abf4dce7c8045701490000000000000000007bb412000000000000000000000000000000000000000001203ba717f69b6ed214ef1a105bda7756149cee25c0c92c48a7f2d59dee88997cec3f9254df2bd2476cf2df16b10ebca0937f8daf2eecccfb8848e4faed9b8c0df7')
1225+
self.doit()
1226+
1227+
12601228
def test_credit_deal_expired(self):
12611229
self.op = operations.Credit_deal_expired(
12621230
**{
@@ -1270,5 +1238,40 @@ def test_credit_deal_expired(self):
12701238
"fee_rate": 1,
12711239
}
12721240
)
1273-
self.cm = ()
1274-
self.doit(1)
1241+
self.cm = ('f68585abf4dce7c80457014a000000000000000000b412017b7b000000000000000000000000000000000000010000000001207e5770f0fae74fc78bebbe5267583a824999d6356698ebce0a25e4a468bd3e356ca10920e3c4301537bd02205e63617546a5d8eded230655d170529801838a3f')
1242+
self.doit()
1243+
1244+
1245+
def compareConstructedTX(self):
1246+
self.maxDiff = None
1247+
self.op = operations.Call_order_update(
1248+
**{
1249+
"fee": {"amount": 100, "asset_id": "1.3.0"},
1250+
"delta_debt": {"amount": 10000, "asset_id": "1.3.22"},
1251+
"delta_collateral": {"amount": 100000000, "asset_id": "1.3.0"},
1252+
"funding_account": "1.2.29",
1253+
"extensions": {"target_collateral_ratio": 12345},
1254+
}
1255+
)
1256+
ops = [Operation(self.op)]
1257+
tx = Signed_Transaction(
1258+
ref_block_num=ref_block_num,
1259+
ref_block_prefix=ref_block_prefix,
1260+
expiration=expiration,
1261+
operations=ops,
1262+
)
1263+
tx = tx.sign([wif], chain=prefix)
1264+
tx.verify([PrivateKey(wif).pubkey], prefix)
1265+
txWire = hexlify(bytes(tx)).decode("ascii")
1266+
print("=" * 80)
1267+
pprint(tx.json())
1268+
print("=" * 80)
1269+
1270+
# Test against Bitshares backened
1271+
self.cm = bitshares.rpc.get_transaction_hex(tx.json())
1272+
1273+
print("soll: %s" % self.cm[:-130])
1274+
print("ist: %s" % txWire[:-130])
1275+
print(txWire[:-130] == self.cm[:-130])
1276+
self.assertEqual(self.cm[:-130], txWire[:-130])
1277+

0 commit comments

Comments
 (0)