Beispiel #1
0
def withdrawal():
    User.setAccount(Utils.inputHelp("账号"))
    User.setPassword(Utils.inputHelp("密码"))
    Bank.setMoney(Utils.inputHelp("要取出的金额"))


    start = Bank.bank_withdrawal(User.getAccount(),User.getPassword(),Bank.getMoney())
    if start == 0:
        print("取款成功!")
    if start == 1:
        print("账号不存在!")
    if start == 2:
        print("密码不对")
    if start == 3:
        print("账户余额不足")
Beispiel #2
0
class TestWithdrawal(unittest.TestCase):
    user = None
    bank = None

    def setUp(self) -> None:
        self.user = User()
        self.bank = Bank()

    def test_Withdrawal1(self):
        # 1.准备数据
        self.user.setAccount("qqq666")
        self.user.setPassword("123456")
        self.bank.setMoney("1111")

        # 2.预期结果
        teststart = 0

        # 3.调用被测试方法
        start = self.bank.bank_withdrawal(self.user.getAccount(),
                                          self.user.getPassword(),
                                          self.bank.getMoney())

        # 4.断言
        self.assertEqual(teststart, start)