Set up redeem test case and refund test case

This commit is contained in:
Jay Graber 2017-07-05 13:57:53 -07:00
parent 15f48b7ad4
commit dc6a9bdb6f
1 changed files with 24 additions and 4 deletions

28
test.py
View File

@ -1,14 +1,18 @@
import unittest
from api import *
from utils import *
import sys
class SimpleTestCase(unittest.TestCase):
class TestRefundConditions(unittest.TestCase):
def setUp(self):
print("Starting testing 123")
print("Starting test of redeem conditions...")
self.htlcTrade = initiate()
class TestRedeem(SimpleTestCase):
def testfundBuyer(self):
def testSetUp(self):
# There is a fund_tx and it is not a boolean
self.assertTrue(len(self.htlcTrade.sellContract.fund_tx) > 20)
def testRefund(self):
fund_buyer()
# zXcat.generate(8)
zXcat.generate(6)
@ -20,6 +24,22 @@ class TestRedeem(SimpleTestCase):
print("sellContract redeem_tx is:", trade.sellContract.redeem_tx)
self.assertEqual(trade.sellContract.redeem_tx, False)
class TestRedeem(unittest.TestCase):
def setUp(self):
print("Starting test of refund conditions...")
self.htlcTrade = initiate()
# Case where both parties act in good faith
def testRedeem(self):
fund_buyer()
zXcat.generate(1)
redeem_seller()
zXcat.generate(1)
bXcat.generate(1)
redeem_buyer()
trade = get_trade()
print("sellContract redeem_tx is:", trade.sellContract.redeem_tx)
if __name__ == '__main__':
unittest.main()