python - 邮箱仅在最后一个灯具时有效
问题描述
如果我像这样使用邮箱设备,它可以工作:
def test_send_invoices_via_mail_page(user_client, invoice, mailoutbox):
url = reverse(send_invoices_via_mail_page)
response = user_client.get(url)
assert response.status_code == 200
log = LogOfInvoiceMail.objects.get(invoice=invoice)
assert log.success, log.exception
assert log.invoice == invoice
assert log.exception == ''
assert len(mailoutbox) == 1, mailoutbox
但是,如果我这样使用它,它会失败:
def test_send_invoices_via_mail_page(mailoutbox, user_client, invoice):
错误:
> assert len(mailoutbox) == 1, mailoutbox
E AssertionError: []
E assert 0 == 1
为什么参数的顺序在这里很重要?
我 100% 确定mail.send_mail()
在这两种情况下都会调用它,因为我测试了十次(用十种不同的方式)。
解决方案
推荐阅读
- angular - 无法读取已定义对象的“长度”属性
- arduino - 为什么延迟指令会导致编译器错误?
- shell - 通过外壳插入文件以进行流入测量时出现“无效布尔”错误
- confluence - 我们可以为 Confluence 页面链接外部 API 吗?
- performance - 衡量ec2实例之间tcp性能的正确方法
- django - 如何修复 Swagger 中的混合内容错误?
- php - 如何安装 php7 cli 和现有的 php 5.5
- javascript - 由于繁重的 JS 函数,未调用 HTML 元素更新事件
- php - 致命错误:不支持的操作数类型 - Cake PHP
- databricks - 使用服务主体从 Databricks 访问 Blob 存储