Skip to content

Commit 208df71

Browse files
pi314xxeroc
authored andcommitted
Update test_transactions.py
added tests for samet_fund, credit_offer, credit_deal
1 parent d416313 commit 208df71

1 file changed

Lines changed: 195 additions & 0 deletions

File tree

tests/test_transactions.py

Lines changed: 195 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1077,3 +1077,198 @@ def compareConstructedTX(self):
10771077
print("ist: %s" % txWire[:-130])
10781078
print(txWire[:-130] == self.cm[:-130])
10791079
self.assertEqual(self.cm[:-130], txWire[:-130])
1080+
1081+
def test_samet_fund_create(self):
1082+
self.op = operations.Samet_fund_create(
1083+
**{
1084+
"fee": {"amount": 0, "asset_id": "1.3.0"},
1085+
"owner_account": "1.2.123",
1086+
"asset_type": "1.3.0",
1087+
"balance": 10000,
1088+
"fee_rate": 1,
1089+
"extensions": [],
1090+
}
1091+
)
1092+
self.cm = ()
1093+
self.doit(1)
1094+
1095+
1096+
def test_samet_fund_delete(self):
1097+
self.op = operations.Samet_fund_delete(
1098+
**{
1099+
"fee": {"amount": 0, "asset_id": "1.3.0"},
1100+
"owner_account": "1.2.123",
1101+
"fund_id": "1.20.1",
1102+
"extensions": [],
1103+
}
1104+
)
1105+
self.cm = ()
1106+
self.doit(1)
1107+
1108+
1109+
def test_samet_fund_update(self):
1110+
self.op = operations.Samet_fund_update(
1111+
**{
1112+
"fee": {"amount": 0, "asset_id": "1.3.0"},
1113+
"owner_account": "1.2.123",
1114+
"fund_id": "1.20.1",
1115+
"delta_amount": 100,
1116+
"new_fee_rate": 2,
1117+
"extensions": [],
1118+
}
1119+
)
1120+
self.cm = ()
1121+
self.doit(1)
1122+
1123+
1124+
def test_samet_fund_borrow(self):
1125+
self.op = operations.Samet_fund_borrow(
1126+
**{
1127+
"fee": {"amount": 0, "asset_id": "1.3.0"},
1128+
"borrower": "1.2.123",
1129+
"fund_id": "1.20.1",
1130+
"borrow_amount": {"amount": 10, "asset_id": "1.3.0"},
1131+
"extensions": [],
1132+
}
1133+
)
1134+
self.cm = ()
1135+
self.doit(1)
1136+
1137+
1138+
def test_samet_fund_repay(self):
1139+
self.op = operations.Samet_fund_repay(
1140+
**{
1141+
"fee": {"amount": 0, "asset_id": "1.3.0"},
1142+
"account": "1.2.123",
1143+
"fund_id": "1.20.1",
1144+
"repay_amount": {"amount": 10, "asset_id": "1.3.0"},
1145+
"fund_fee": {"amount": 10, "asset_id": "1.3.0"},
1146+
"extensions": [],
1147+
}
1148+
)
1149+
self.cm = ()
1150+
self.doit(1)
1151+
1152+
1153+
def test_credit_offer_create(self):
1154+
self.op = operations.Credit_offer_create(
1155+
**{
1156+
"fee": {"amount": 0, "asset_id": "1.3.0"},
1157+
"owner_account": "1.2.123",
1158+
"asset_type": "1.3.0",
1159+
"balance": 10000,
1160+
"fee_rate": 1,
1161+
"max_duration_seconds": 10000,
1162+
"min_deal_amount": 1000,
1163+
"enabled": True,
1164+
"auto_disable_time": 1000,
1165+
"acceptable_collateral":
1166+
[0,
1167+
{
1168+
"asset": "1.2.1"
1169+
}
1170+
],
1171+
"acceptable_borrowers":
1172+
[0,
1173+
{
1174+
"account": "1.2.1"
1175+
}
1176+
],
1177+
"extensions": [],
1178+
}
1179+
)
1180+
self.cm = ()
1181+
self.doit(1)
1182+
1183+
1184+
def test_credit_offer_delete(self):
1185+
self.op = operations.Credit_offer_delete(
1186+
**{
1187+
"fee": {"amount": 0, "asset_id": "1.3.0"},
1188+
"owner_account": "1.2.123",
1189+
"offer_id": "1.21.1",
1190+
"extensions": [],
1191+
}
1192+
)
1193+
self.cm = ()
1194+
self.doit(1)
1195+
1196+
1197+
def test_credit_offer_update(self):
1198+
self.op = operations.Credit_offer_update(
1199+
**{
1200+
"fee": {"amount": 0, "asset_id": "1.3.0"},
1201+
"owner_account": "1.2.123",
1202+
"offer_id": "1.21.1",
1203+
"delta_amount": {"amount": 1, "asset_id": "1.3.0"},
1204+
"fee_rate": 1,
1205+
"max_duration_seconds": 1000,
1206+
"min_deal_amount": 10,
1207+
"enabled": True,
1208+
"auto_disable_time": False,
1209+
"acceptable_collateral":
1210+
[0,
1211+
{
1212+
"asset": "1.2.1"
1213+
}
1214+
],
1215+
"acceptable_borrowers":
1216+
[0,
1217+
{
1218+
"account": "1.2.1"
1219+
}
1220+
],
1221+
"extensions": [],
1222+
}
1223+
)
1224+
self.cm = ()
1225+
self.doit(1)
1226+
1227+
1228+
def test_credit_offer_accept(self):
1229+
self.op = operations.Credit_offer_accept(
1230+
**{
1231+
"fee": {"amount": 0, "asset_id": "1.3.0"},
1232+
"borrower": "1.2.123",
1233+
"offer_id": "1.21.1",
1234+
"borrow_amount": {"amount": 10, "asset_id": "1.3.0"},
1235+
"collateral": {"amount": 10, "asset_id": "1.3.0"},
1236+
"max_fee_rate": 1,
1237+
"min_duration_seconds": 1000,
1238+
"extensions": [],
1239+
}
1240+
)
1241+
self.cm = ()
1242+
self.doit(1)
1243+
1244+
1245+
def test_credit_deal_repay(self):
1246+
self.op = operations.Credit_deal_repay(
1247+
**{
1248+
"fee": {"amount": 0, "asset_id": "1.3.0"},
1249+
"account": "1.2.123",
1250+
"deal_id": "1.22.2356",
1251+
"repay_amount": {"amount": 10, "asset_id": "1.3.0"},
1252+
"credit_fee": {"amount": 10, "asset_id": "1.3.0"},
1253+
"extensions": [],
1254+
}
1255+
)
1256+
self.cm = ()
1257+
self.doit(1)
1258+
1259+
1260+
def test_credit_deal_expired(self):
1261+
self.op = operations.Credit_deal_expired(
1262+
**{
1263+
"fee": {"amount": 0, "asset_id": "1.3.0"},
1264+
"deal_id": "1.22.2356",
1265+
"offer_id": "1.21.1",
1266+
"offer_owner": "1.2.123",
1267+
"borrower": "1.2.123",
1268+
"unpaid_amount": {"amount": 10, "asset_id": "1.3.0"},
1269+
"collateral": {"amount": 10, "asset_id": "1.3.0"},
1270+
"fee_rate": 1,
1271+
}
1272+
)
1273+
self.cm = ()
1274+
self.doit(1)

0 commit comments

Comments
 (0)