zoukankan      html  css  js  c++  java
  • pytest_作业day17

    #!/usr/bin/python3
    # -*- coding: utf-8 -*-
    # @Project: PycharmProjects
    # @File: test_case3.py
    # @Time: 2021/2/23 00:26
    # @Author: TEST_Memory.荒年〆
    # @Email: 981874735@qq.com
    """
    1、账号密码正确
    入参:账号python27 密码lemonban
    预期结果:{"code": 0, "msg": "登录成功"}
    实际结果:
    
    2、账号正确,密码错误
    入参:账号python27 密码lemonban11
    预期结果:{"code": 1, "msg": "账号或密码不正确"}
    实际结果:
    
    3、账号错误,密码正确,
    入参:账号python25 密码lemonban
    预期结果:{"code": 1, "msg": "账号或密码不正确"}
    实际结果:
    
    4、账号为空
    入参:账号为空 密码lemonban11
    预期结果:{"code": 1, "msg": "所以的参数不能为空"}
    实际结果:
    
    5、密码为空、
    入参:账号Python6 密码为空
    预期结果:{"code": 1, "msg": "所以的参数不能为空"}
    实际结果
    """
    from py_37.Py_Pytest.day17.login import login_check
    # from ddt import ddt,data
    #
    # datas = [
    #     {"username":"python27","password":"lemonban","check":{"code": 0, "msg": "登录成功"}},
    #     {"username":"python27","password":"lemonban11","check":{"code": 1, "msg": "账号或密码不正确"}},
    #     {"username":"python25","password":"lemonban","check":{"code": 1, "msg": "账号或密码不正确"}},
    #     {"username":"","password":"lemonban","check":{"code": 1, "msg": "所以的参数不能为空"}},
    #     {"username":"python25","password":"","check":{"code": 1, "msg": "所以的参数不能为空"}},
    #     {"username":"","password":"","check":{"code": 1, "msg": "所以的参数不能为空"}}
    # ]
    #
    # @ddt
    # class TestLogin():
    #
    #     @data(*datas)
    #     def test_login(self,case):
    #         # 1、测试数据 # 2、测试步骤
    #         res = login_check(case["username"],case["password"])
    #         # 3、断言:预期结果与实际结果的比对
    #         assert(res,case["check"])
    
    class TestLogin():
    
        def test_1(self):
            # 1、测试数据 # 2、测试步骤
            res = login_check("python37", "lemonban")
            # 3、断言:预期结果与实际结果的比对
            assert res == {"code": 0, "msg": "登录成功"}
    
        def test_2(self):
            # 1、测试数据 # 2、测试步骤
            res = login_check("python37", "lemonban666")
            # 3、断言:预期结果与实际结果的比对
            assert res == {"code": 1, "msg": "账号或密码不正确"}
    
        def test_3(self):
            # 1、测试数据 # 2、测试步骤
            res = login_check("python370", "lemonban")
            # 3、断言:预期结果与实际结果的比对
            assert res == {"code": 1, "msg": "账号或密码不正确"}
    
        def test_4(self):
            # 1、测试数据 # 2、测试步骤
            res = login_check(password="lemonban11")
            # 3、断言:预期结果与实际结果的比对
            assert res == {"code": 1, "msg": "所以的参数不能为空"}
    
        def test_5(self):
            # 1、测试数据 # 2、测试步骤
            res = login_check("python37")
            # 3、断言:预期结果与实际结果的比对
            assert res == {"code": 1, "msg": "所以的参数不能为空"}
  • 相关阅读:
    升级windows 11小工具
    windows 10更新升级方法
    您需要了解的有关 Oracle 数据库修补的所有信息
    Step by Step Apply Rolling PSU Patch In Oracle Database 12c RAC Environment
    Upgrade Oracle Database Manually from 12.2.0.1 to 19c
    如何应用版本更新 12.2.0.1.210420(补丁 32507738 – 2021 年 4 月 RU)
    xtrabackup 安装、备份和恢复
    Centos_Lvm expand capacity without restarting CentOS
    Centos_Lvm_Create pv vg lv and mount
    通过全备+relaylog同步恢复被drop的库或表
  • 原文地址:https://www.cnblogs.com/zhang-ping1205/p/14448431.html
Copyright © 2011-2022 走看看