您好我一直在尝试为以下保存信号编写测试用例,但没有任何成功。任何人都可以提供帮助。
@receiver(post_save, sender=Item, dispatch_uid="item_created")
def notify_member_item_create(sender, instance, **kwargs):
email_subject = "email_subject"
email_body = "email_body"
email_list = [instance.inventory.owner.email]
send_mail(email_subject, email_body, settings.EMAIL_HOST_USER, email_list)
答案 0 :(得分:0)
请问你的问题更具体吗?但如果您需要编写测试以检查信号是如何工作的,您可以编写类似的测试
'{user:"asdf",loginToken:"bla"}' -> '{"user":"asdf", "loginToken":"bla"}'