本文整理汇总了Python中callisto.delivery.models.Report.match_found方法的典型用法代码示例。如果您正苦于以下问题:Python Report.match_found方法的具体用法?Python Report.match_found怎么用?Python Report.match_found使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类callisto.delivery.models.Report
的用法示例。
在下文中一共展示了Report.match_found方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_deleted_report_doesnt_delete_sent_match_report
# 需要导入模块: from callisto.delivery.models import Report [as 别名]
# 或者: from callisto.delivery.models.Report import match_found [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)
示例2: test_can_withdraw_from_matching
# 需要导入模块: from callisto.delivery.models import Report [as 别名]
# 或者: from callisto.delivery.models.Report import match_found [as 别名]
def test_can_withdraw_from_matching(self):
report = Report(owner=self.user)
report.encrypt_report("test report", "key")
report.save()
MatchReport.objects.create(report=report, contact_email='[email protected]', identifier='dummy')
self.assertIsNotNone(Report.objects.first().entered_into_matching)
report.match_found = True
report.save()
report.withdraw_from_matching()
report.save()
self.assertIsNone(Report.objects.first().entered_into_matching)
self.assertFalse(Report.objects.first().match_found)