Beispiel #1
0
class TestBank_save(unittest.TestCase):
    def setUp(self) -> None:
        self.u = User_method()
        self.ur = User()

    def test_savve(self):
        equ = 1
        self.ur.setId("12345670")
        self.ur.setBalance(100)
        save = self.u.savemoney(self.ur)
        self.assertEqual(equ, save)

    def test_savve1(self):
        equ = 2
        self.ur.setId("12345673")
        self.ur.setBalance(100)
        save = self.u.savemoney(self.ur)
        self.assertEqual(equ, save)
Beispiel #2
0
class TestBank(unittest.TestCase):
    def setUp(self) -> None:
        self.u = User_method()
        self.ur = User()
        self.ad = Address()
        self.db = DBUtils

    def test_Open(self):
        self.ur.setId("12345675")
        self.ur.setName("张三")
        self.ur.setPassword("111111")
        self.ur.setBalance(0)
        self.ad.setCountry("中国")
        self.ad.setProvince("河北")
        self.ad.setStreet("中华大街")
        self.ad.setDoor("101")
        self.ur.setTime("1")
        open = self.u.method(self.ur, self.ad)

        equ = 1
        self.assertEqual(equ, open)

    def test_Open1(self):
        self.ur.setId("12345679")
        self.ur.setName("张三")
        self.ur.setPassword("111111")
        self.ur.setBalance(0)
        self.ad.setCountry("中国")
        self.ad.setProvince("河北")
        self.ad.setStreet("中华大街")
        self.ad.setDoor("101")
        self.ur.setTime("1")
        open = self.u.method(self.ur, self.ad)

        equ = 2
        self.assertEqual(equ, open)

    def test_Open2(self):
        equ = 3
        equ1 = 1
        self.ur.setId("12345670")
        self.ur.setName("张三")
        self.ur.setPassword("111111")
        self.ur.setBalance(0)
        self.ad.setCountry("中国")
        self.ad.setProvince("河北")
        self.ad.setStreet("中华大街")
        self.ad.setDoor("101")
        self.ur.setTime("1")
        # open = self.u.method(self.ur, self.ad)
        data = self.db.select("select * from user", [])
        if len(data) == 99:
            open1 = 1
            self.assertEqual(equ1, open1)
        elif len(data) == 100:
            open2 = 3
            self.assertEqual(equ, open2)
        elif len(data) > 100:
            open3 = 3
            self.assertEqual(equ, open3)
Beispiel #3
0
class TestBank_transfer(unittest.TestCase):
    def setUp(self) -> None:
        self.u = User_method()
        self.ur = User()

    def testTransfer(self):
        equ = 0
        self.ur.setId("12345670")
        user = "******"
        self.ur.setPassword("111111")
        self.ur.setBalance(100)
        transfer = self.u.transfer(self.ur, user)
        self.assertEqual(equ, transfer)

    def testTransfer1(self):
        equ = 1
        self.ur.setId("12345678")
        user = "******"
        self.ur.setPassword("111111")
        self.ur.setBalance(100)
        transfer = self.u.transfer(self.ur, user)
        self.assertEqual(equ, transfer)

    def testTransfer2(self):
        equ = 2
        self.ur.setId("12345670")
        user = "******"
        self.ur.setPassword("111112")
        self.ur.setBalance(100)
        transfer = self.u.transfer(self.ur, user)
        self.assertEqual(equ, transfer)

    def testTransfer3(self):
        equ = 3
        self.ur.setId("12345670")
        user = "******"
        self.ur.setPassword("111111")
        self.ur.setBalance(1000)
        transfer = self.u.transfer(self.ur, user)
        self.assertEqual(equ, transfer)
Beispiel #4
0
class TestBank_get(unittest.TestCase):
    def setUp(self) -> None:
        self.u = User_method()
        self.ur = User()

    def testGet(self):
        equ = 0
        self.ur.setId("12345670")
        self.ur.setPassword("111111")
        self.ur.setBalance("100")
        get = self.u.getmoney(self.ur)
        self.assertEqual(equ, get)

    def testGet1(self):
        equ = 1
        self.ur.setId("12345677")
        self.ur.setPassword("111111")
        self.ur.setBalance("100")
        get = self.u.getmoney(self.ur)
        self.assertEqual(equ, get)

    def testGet2(self):
        equ = 2
        self.ur.setId("12345670")
        self.ur.setPassword("111112")
        self.ur.setBalance("100")
        get = self.u.getmoney(self.ur)
        self.assertEqual(equ, get)

    def testGet4(self):
        equ = 3
        self.ur.setId("12345670")
        self.ur.setPassword("111111")
        self.ur.setBalance("1000")
        get = self.u.getmoney(self.ur)
        self.assertEqual(equ, get)