예제 #1
0
class Testbank_adduser(unittest.TestCase):
    def setUp(self) -> None:
        self.user = User()
        self.address = Address()
        self.bank_adduser = bank_adduser()

    def test_kaihu(self):
        self.user.setAccount("98989898")
        self.user.setUserame("857857")
        self.user.setPassword("258")
        self.address.setCountry("中国")
        self.address.setProvience("阿拉伯")
        self.address.setStreet("大家雕塑")
        self.address.setDoor("第五")
        self.user.setMoney(0)
        a = 1

        add = self.bank_adduser.addbank_adduser(self.user, self.address)
        self.assertEqual(a, add)

    def test_kaihu1(self):
        self.user.setAccount("8abb3f97")
        self.user.setUserame("857857")
        self.user.setPassword("258")
        self.address.setCountry("中国")
        self.address.setProvience("阿拉伯")
        self.address.setStreet("大家雕塑")
        self.address.setDoor("第五")
        self.user.setMoney(0)
        a = 2

        add = self.bank_adduser.addbank_adduser(self.user, self.address)
        self.assertEqual(a, add)
예제 #2
0
class Test_changemoney(unittest.TestCase):
    def setUp(self) -> None:
        self.user = User()
        self.bank_adduser = bank_adduser()

    def testchangemoney(self):
        self.user.setAccount("0a3f4357")
        inu = "70673e1b"
        self.user.setPassword("1")
        self.user.setMoney(2)
        a = 0

        change = self.bank_adduser.transfer(self.user, inu)
        self.assertEqual(a, change)

    def testchangemoney1(self):
        self.user.setAccount("564645555")
        inu = "70673e1b"
        self.user.setPassword("1")
        self.user.setMoney(2)
        a = 1

        change = self.bank_adduser.transfer(self.user, inu)
        self.assertEqual(a, change)

    def testchangemoney2(self):
        self.user.setAccount("0a3f4357")
        inu = "70673e1p"
        self.user.setPassword("1")
        self.user.setMoney(2)
        a = 1

        change = self.bank_adduser.transfer(self.user, inu)
        self.assertEqual(a, change)

    def testchangemoney3(self):
        self.user.setAccount("0a3f4357")
        inu = "70673e1b"
        self.user.setPassword("989898989898")
        self.user.setMoney(2)
        a = 2

        change = self.bank_adduser.transfer(self.user, inu)
        self.assertEqual(a, change)

    def testchangemoney4(self):
        self.user.setAccount("0a3f4357")
        inu = "70673e1b"
        self.user.setPassword("1")
        self.user.setMoney(898989)
        a = 3

        change = self.bank_adduser.transfer(self.user, inu)
        self.assertEqual(a, change)
예제 #3
0
class Testbank_savemoney(unittest.TestCase):
    def setUp(self) -> None:
        self.user = User()
        self.address = Address()
        self.bank_adduser = bank_adduser()

    def test_savemoney(self):
        self.user.setAccount("8abb3f97")
        self.user.setPassword("123654")
        self.user.setMoney(1999.01)
        a = 1

        save = self.bank_adduser.savemoney(self.user)
        self.assertEqual(a, save)

    def test_savemoney1(self):
        self.user.setAccount("98574844")
        self.user.setPassword("123654")
        self.user.setMoney(1999.01)
        a = False

        save = self.bank_adduser.savemoney(self.user)
        self.assertEqual(a, save)
예제 #4
0
class Test_getmoney(unittest.TestCase):
    def setUp(self) -> None:
        self.user = User()
        self.bank_adduser = bank_adduser()
    def test_getmoney(self):
        self.user.setAccount("0a3f4357")
        self.user.setPassword("1")
        self.user.setMoney(1)
        a = 0

        save = self.bank_adduser.getmoney(self.user)
        self.assertEqual(a,save)

    def test_getmoney1(self):
        self.user.setAccount("01234567")
        self.user.setPassword("1")
        self.user.setMoney(1)
        a = 1

        save = self.bank_adduser.getmoney(self.user)
        self.assertEqual(a,save)

    def test_getmoney2(self):
        self.user.setAccount("0a3f4357")
        self.user.setPassword("8989898998989")
        self.user.setMoney(1)
        a = 2

        save = self.bank_adduser.getmoney(self.user)
        self.assertEqual(a,save)

    def test_getmoney3(self):
        self.user.setAccount("0a3f4357")
        self.user.setPassword("1")
        self.user.setMoney(100)
        a = 3

        save = self.bank_adduser.getmoney(self.user)
        self.assertEqual(a,save)