def test_audit(self): purchase_order = PurchaseOrderFactory.build(order_number='two') instance = AuditFactory.build(agreement=purchase_order) self.assertIn(' two,', str(instance)) purchase_order = PurchaseOrderFactory.build(order_number='tv\xe5') instance = AuditFactory.build(agreement=purchase_order) self.assertIn(' tv\xe5,', str(instance))
def setUpTestData(cls): cls.aggregate_hact = AggregateHactFactory() cls.partner = PartnerFactory( name="Partner Name", partner_type=PartnerType.CIVIL_SOCIETY_ORGANIZATION, shared_with=[PartnerOrganization.AGENCY_CHOICES.UN], rating=PartnerOrganization.RATING_HIGH, total_ct_cp=200.0, total_ct_cy=400.0, net_ct_cy=110000.0, reported_cy=300.0, total_ct_ytd=140000.0, ) cls.partner2 = PartnerFactory( name="Partner Name", partner_type=PartnerType.GOVERNMENT, shared_with=[PartnerOrganization.AGENCY_CHOICES.UNHCR], rating=PartnerOrganization.RATING_LOW, total_ct_cp=200.0, total_ct_cy=2200.0, net_ct_cy=510000.0, reported_cy=52000.0, total_ct_ytd=550000.0, ) AuditFactory( status=Engagement.FINAL, audit_opinion=Audit.OPTION_UNQUALIFIED, date_of_draft_report_to_unicef=datetime(datetime.today().year, 1, 3), additional_supporting_documentation_provided=1000.0, justification_provided_and_accepted=20000.0, write_off_required=30000.0, amount_refunded=400000.0, audited_expenditure=50.0, financial_findings=999.0, ) AuditFactory( status=Engagement.FINAL, audit_opinion=Audit.OPTION_UNQUALIFIED, date_of_draft_report_to_unicef=datetime(datetime.today().year - 1, 1, 3), additional_supporting_documentation_provided=10.0, justification_provided_and_accepted=20.0, write_off_required=30.0, amount_refunded=40.0, audited_expenditure=50.0, financial_findings=100.0, )
def test_pending_unsupported_amount(self): audit = AuditFactory( financial_findings=0, amount_refunded=0, additional_supporting_documentation_provided=0, justification_provided_and_accepted=0, write_off_required=0, ) self.assertEqual(audit.pending_unsupported_amount, 0)
def test_get_financial_findings_numbers(self): def _check_item(financial_dict_item, name, value): self.assertEqual(financial_dict_item['name'], name) self.assertEqual(financial_dict_item['value'], value) RiskFactory(value=4, engagement=AuditFactory( status=Engagement.FINAL, audit_opinion=Audit.OPTION_QUALIFIED, date_of_draft_report_to_unicef=datetime( datetime.today().year, 1, 3), )) RiskFactory(value=2, engagement=AuditFactory( status=Engagement.FINAL, audit_opinion=Audit.OPTION_ADVERSE, date_of_draft_report_to_unicef=datetime( datetime.today().year - 1, 4, 7), )) RiskFactory(value=1, engagement=AuditFactory( status=Engagement.PARTNER_CONTACTED, audit_opinion=Audit.OPTION_DENIAL, date_of_draft_report_to_unicef=datetime( datetime.today().year, 4, 7), )) financial_findings_numbers = self.aggregate_hact.get_financial_findings_numbers( ) self.assertEqual(len(financial_findings_numbers), 4) _check_item(financial_findings_numbers[0], 'Number of High Priority Findings', 1) _check_item(financial_findings_numbers[1], 'Number of Medium Priority Findings', 0) _check_item(financial_findings_numbers[2], 'Number of Low Priority Findings', 0) self.assertEqual(len(financial_findings_numbers[3]['value']), 4) _check_item(financial_findings_numbers[3]['value'][0], 'qualified', 1) _check_item(financial_findings_numbers[3]['value'][1], 'unqualified', 1) _check_item(financial_findings_numbers[3]['value'][2], 'denial', 0) _check_item(financial_findings_numbers[3]['value'][3], 'adverse', 0)
def setUpTestData(cls): cls.user = UserFactory() cls.audit = AuditFactory() cls.attachment = AttachmentFactory(content_object=cls.audit)