Example #1
0
    def test_risk(self):
        purchase_order = PurchaseOrderFactory.build(order_number='two')
        engagement = EngagementFactory.build(agreement=purchase_order)
        instance = RiskFactory.build(engagement=engagement)
        self.assertIn(' two,', str(instance))

        purchase_order = PurchaseOrderFactory.build(order_number='tv\xe5')
        engagement = EngagementFactory.build(agreement=purchase_order)
        instance = RiskFactory.build(engagement=engagement)
        self.assertIn(' tv\xe5,', str(instance))
Example #2
0
    def test_risk(self):
        purchase_order = PurchaseOrderFactory.build(order_number='two')
        engagement = EngagementFactory.build(agreement=purchase_order)
        instance = RiskFactory.build(engagement=engagement)
        self.assertIn(' two,', str(instance))

        purchase_order = PurchaseOrderFactory.build(order_number='tv\xe5')
        engagement = EngagementFactory.build(agreement=purchase_order)
        instance = RiskFactory.build(engagement=engagement)
        self.assertIn(' tv\xe5,', str(instance))
Example #3
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)
Example #4
0
 def _fill_category(self, code, **kwargs):
     blueprints = RiskBluePrint.objects.filter(category__code=code)
     for blueprint in blueprints:
         RiskFactory(blueprint=blueprint,
                     engagement=self.engagement,
                     **kwargs)