Ejemplo n.º 1
0
class TestSeek(unittest.TestCase):
    user = None
    bank = None
    def setUp(self) -> None:
        self.user = User()
        self.bank = Bank()

    def test_seek1(self):
        self.user.setAccount("qqq666")
        self.user.setPassword("123456")
        #预期结果
        teststart = 0

        start = self.bank.bank_seek(self.user.getAccount(),self.user.getPassword())

        self.assertEqual(teststart,start)

    def test_seek2(self):
        self.user.setAccount("qqqqqq15")
        self.user.setPassword("123456")

        teststart = 1

        start = self.bank.bank_seek(self.user.getAccount(),self.user.getPassword())

        self.assertEqual(teststart,start)
    #
    # def test_seek3(self):
    #     self.user.setAccount("qqqqqq16")
    #     self.user.setPassword("weqweqw")
    #
    #     teststart = 2
    #
    #     start = self.bank.bank_seek(self.user.getAccount(),self.user.getPassword())
    #
    #     self.assertEqual(teststart,start)
Ejemplo n.º 2
0
def seek():
    User.setAccount(Utils.inputHelp("您的要查询的账号"))
    User.setPassword(Utils.inputHelp("密码"))

    start = Bank.bank_seek(User.getAccount(),User.getPassword())
    if start == 0:
        # 查询表中数据
        sql = "select * from user_data where account = %s and passwords = %s"
        param = [User.getAccount(),User.getPassword()]
        # 执行sql
        data = DB.Select(sql, param)
        for i in data:
            account = data[0][0]
            username = data[0][1]
            password = data[0][2]
            cunrry = data[0][3]
            province = data[0][4]
            street = data[0][5]
            door = data[0][6]
            money = data[0][7]
            bank_name = data[0][8]
        print("以下为您的账号信息")
        info = '''
                ----------- 个人信息-------------
                账号: %s,
                用户名: %s,
                取款密码: %s,
                地址信息: 
                        国家: %s,
                        省份: %s,
                        街道: %s,
                        门牌号: %s,
                余额: %s,
                开户行: %s
                ---------------------------------
                '''
        print(info % (account,username,password,cunrry,province,street,door,money,bank_name))
    if start == 1:
        print("该用户不存在")
    if start == 2:
        print("您输入的密码不正确")