python-3.x - 如何使用 Pytest 从 Firebase 测试用户的可选信息
问题描述
我在 Firebase 上启用了匿名登录方法,因此我的用户集合中有一些不需要的信息。我想知道如何使用 pytest 和参数化进行测试。
我的用户集合将如下所示:
{
"users":[
{
"id": "",
"name": "" || null,
"email": "" || null,
"password": "" || null,
"birthdate": Long/Number || null,
"parents_contact": "" || null,
}
]
}
匿名登录方式只需要id。
我很难写这样的东西:
@pytest.mark.parametrize(
"id, data, status_code",
[
[1, {}, 200],
[1, {"name": "John"}, 200],
[1, {"name": "John", "email": "john@mail.com"}, 200],
[1, {"name": "John", "email": "john@mail.com", "password": "john123"}, 200],
...
],
)
这是使用 pytest 和的正确方法parametrize
吗?
解决方案
推荐阅读
- javascript - Mongoose 使用 MERN 堆栈设置具有多个子模式的模式
- python-3.x - 使用获取 cookie 进行发布请求
- c# - 字符串或二进制数据将被截断。该语句已终止。在数据库表中插入记录时
- swift - INInteraction.delete 在 iOS13.7 中不起作用
- python - 如何仅在 matplotlib 的体素上为外部边缘着色?
- django - django模型上返回外键计数的方法
- extbase - 如何使用 TYPO3 v10 Extension Builder 来增强页面
- linux - 将 Docker run 的参数添加到 docker-compose
- sql - 显示在伦敦工作的销售人员的销售 ID 和销售日期
- java - Android Studio 4.0.1 GridLayout 使应用程序崩溃