当前位置: 首页>>代码示例>>Python>>正文


Python Report.delete方法代码示例

本文整理汇总了Python中callisto.delivery.models.Report.delete方法的典型用法代码示例。如果您正苦于以下问题:Python Report.delete方法的具体用法?Python Report.delete怎么用?Python Report.delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在callisto.delivery.models.Report的用法示例。


在下文中一共展示了Report.delete方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_deleted_report_doesnt_delete_sent_match_report

# 需要导入模块: from callisto.delivery.models import Report [as 别名]
# 或者: from callisto.delivery.models.Report import delete [as 别名]
 def test_deleted_report_doesnt_delete_sent_match_report(self):
     match_report = MatchReport(report=self.report, identifier='dummy')
     match_report.encrypt_match_report("test match report", 'dummy')
     match_report.save()
     user2 = User.objects.create_user(username="dummy2", password="dummy")
     report2 = Report(owner=user2)
     report2.encrypt_report("test report 2", "key")
     report2.save()
     match_report2 = MatchReport(report=report2, identifier='dummy')
     match_report2.encrypt_match_report("test match report 2", 'dummy')
     match_report2.save()
     sent_match_report = SentMatchReport.objects.create()
     sent_match_report.reports.add(match_report, match_report2)
     self.report.match_found = True
     self.report.save()
     report2.match_found = True
     report2.save()
     self.assertIsNotNone(match_report.sentmatchreport_set.first())
     self.assertIsNotNone(match_report2.sentmatchreport_set.first())
     self.assertEqual(match_report, SentMatchReport.objects.first().reports.all()[0])
     self.assertEqual(match_report2, SentMatchReport.objects.first().reports.all()[1])
     self.report.delete()
     self.assertEqual(Report.objects.count(), 1)
     self.assertEqual(MatchReport.objects.count(), 1)
     self.assertEqual(SentMatchReport.objects.first(), sent_match_report)
     self.assertEqual(SentMatchReport.objects.first().reports.count(), 1)
     self.assertEqual(SentMatchReport.objects.first().reports.first(), match_report2)
     self.assertTrue(Report.objects.first().match_found)
     report2.delete()
     self.assertEqual(Report.objects.count(), 0)
     self.assertEqual(SentMatchReport.objects.first(), sent_match_report)
开发者ID:Mariatta,项目名称:callisto-core,代码行数:33,代码来源:test_models.py


注:本文中的callisto.delivery.models.Report.delete方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。