Beispiel #1
0
    def test_spot_check(self):
        purchase_order = PurchaseOrderFactory.build(order_number='two')
        instance = SpotCheckFactory.build(agreement=purchase_order)
        self.assertIn(' two,', str(instance))

        purchase_order = PurchaseOrderFactory.build(order_number='tv\xe5')
        instance = SpotCheckFactory.build(agreement=purchase_order)
        self.assertIn(' tv\xe5,', str(instance))
Beispiel #2
0
    def test_spot_check(self):
        purchase_order = PurchaseOrderFactory.build(order_number='two')
        instance = SpotCheckFactory.build(agreement=purchase_order)
        self.assertIn(' two,', str(instance))

        purchase_order = PurchaseOrderFactory.build(order_number='tv\xe5')
        instance = SpotCheckFactory.build(agreement=purchase_order)
        self.assertIn(' tv\xe5,', str(instance))
Beispiel #3
0
    def test_get_spot_checks_completed(self):
        SpotCheckFactory(
            status=Engagement.FINAL, date_of_draft_report_to_unicef=datetime(datetime.today().year, 12, 5))
        SpotCheckFactory(
            status=Engagement.FINAL, date_of_draft_report_to_unicef=datetime(datetime.today().year - 1, 12, 5))
        SpotCheckFactory(
            status=Engagement.FINAL,
            date_of_draft_report_to_unicef=datetime(datetime.today().year, 6, 3),
            agreement__auditor_firm__unicef_users_allowed=True)
        SpotCheckFactory(
            status=Engagement.REPORT_SUBMITTED, date_of_draft_report_to_unicef=datetime(datetime.today().year, 2, 1))

        spot_checks_completed = self.aggregate_hact.get_spot_checks_completed()
        self.assertEqual(len(spot_checks_completed), 3)
        self.assertEqual(spot_checks_completed[1], ['Staff', 1])
        self.assertEqual(spot_checks_completed[2], ['Service Providers', 1])
Beispiel #4
0
    def test_create(self):
        spot_check = SpotCheckFactory()
        create_data = {
            'end_date':
            spot_check.end_date,
            'start_date':
            spot_check.start_date,
            'partner_contacted_at':
            spot_check.partner_contacted_at,
            'total_value':
            spot_check.total_value,
            'partner':
            spot_check.partner_id,
            'authorized_officers':
            spot_check.authorized_officers.values_list('id', flat=True),
            'staff_members':
            spot_check.staff_members.values_list('id', flat=True),
            'active_pd':
            spot_check.active_pd.values_list('id', flat=True),
            'shared_ip_with':
            spot_check.shared_ip_with,
        }

        response = self.forced_auth_req(
            'post',
            reverse('audit:staff-spot-checks-list'),
            user=self.unicef_focal_point,
            data=create_data)

        self.assertEqual(response.status_code, status.HTTP_201_CREATED)
        self.assertIsNotNone(response.data['agreement'])
Beispiel #5
0
 def test_pending_unsupported_amount(self):
     spot_check = SpotCheckFactory(
         total_amount_of_ineligible_expenditure=0,
         additional_supporting_documentation_provided=0,
         justification_provided_and_accepted=0,
         write_off_required=0)
     self.assertEqual(spot_check.pending_unsupported_amount, 0)
Beispiel #6
0
    def test_get_spot_checks_completed(self):
        SpotCheckFactory(status=Engagement.FINAL,
                         date_of_draft_report_to_unicef=datetime(
                             datetime.today().year, 12, 5))
        SpotCheckFactory(status=Engagement.FINAL,
                         date_of_draft_report_to_unicef=datetime(
                             datetime.today().year - 1, 12, 5))
        SpotCheckFactory(status=Engagement.FINAL,
                         date_of_draft_report_to_unicef=datetime(
                             datetime.today().year, 6, 3),
                         partner__vendor_number='0000000000')
        SpotCheckFactory(status=Engagement.REPORT_SUBMITTED,
                         date_of_draft_report_to_unicef=datetime(
                             datetime.today().year, 2, 1))

        spot_checks_completed = self.aggregate_hact.get_spot_checks_completed()
        self.assertEqual(len(spot_checks_completed), 3)
        self.assertEqual(spot_checks_completed[1], ['Staff', 1])
        self.assertEqual(spot_checks_completed[2], ['Service Providers', 1])
Beispiel #7
0
    def test_engagements_list(self):
        spot_check = SpotCheckFactory()
        StaffSpotCheckFactory()

        response = self.forced_auth_req('get',
                                        reverse('audit:engagements-list'),
                                        user=self.unicef_focal_point)

        self.assertEqual(response.status_code, status.HTTP_200_OK)
        self.assertEqual(len(response.data['results']), 1)
        self.assertEqual(response.data['results'][0]['id'], spot_check.id)

        attachments_response = self.forced_auth_req(
            'get',
            reverse('audit:engagement-attachments-list', args=[spot_check.id]),
            user=self.unicef_focal_point,
        )
        self.assertEqual(attachments_response.status_code, status.HTTP_200_OK)
 def setUpTestData(cls):
     cls.user = UserFactory()
     cls.spotcheck = SpotCheckFactory()
     cls.attachment = AttachmentFactory(content_object=cls.spotcheck)