def setUpTestData(cls): cls.user = UserFactory(is_staff=True) # UNICEF staff user cls.result_type = ResultTypeFactory(name=ResultType.OUTPUT) today = datetime.date.today() cls.country_programme = CountryProgrammeFactory( wbs='0000/A0/01', from_date=datetime.date(today.year - 1, 1, 1), to_date=datetime.date(today.year + 1, 1, 1)) cls.result1 = ResultFactory( result_type=cls.result_type, country_programme=cls.country_programme, ) cls.result2 = ResultFactory( result_type=cls.result_type, country_programme=cls.country_programme ) cls.outcome = ResultFactory( result_type=ResultTypeFactory(name=ResultType.OUTCOME), country_programme=cls.country_programme ) cls.url = reverse('reports:report-result-list')
def test_result_name_no_code(self): result_type = ResultTypeFactory(name="RType") result = ResultFactory( code="", result_type=result_type, name="Result" ) self.assertEqual(result.result_name, " RType: Result")
def setUpTestData(cls): cls.unicef_staff = UserFactory(is_staff=True) cls.partner = PartnerFactory( partner_type=PartnerType.CIVIL_SOCIETY_ORGANIZATION, cso_type="International", hidden=False, vendor_number="DDD", short_name="Short name", ) report = "report.pdf" cls.assessment1 = Assessment.objects.create(partner=cls.partner, type="Micro Assessment") cls.assessment2 = Assessment.objects.create( partner=cls.partner, type="Micro Assessment", report=report, completed_date=datetime.date.today()) cls.partner_gov = PartnerFactory(partner_type=PartnerType.GOVERNMENT) agreement = AgreementFactory( partner=cls.partner, signed_by_unicef_date=datetime.date.today()) cls.intervention = InterventionFactory(agreement=agreement) cls.output_res_type = ResultTypeFactory(name=ResultType.OUTPUT) cls.result = ResultFactory(result_type=cls.output_res_type, ) cls.partnership_budget = InterventionBudget.objects.create( intervention=cls.intervention, unicef_cash=100, unicef_cash_local=10, partner_contribution=200, partner_contribution_local=20, in_kind_amount_local=10, ) cls.amendment = InterventionAmendment.objects.create( intervention=cls.intervention, types=[InterventionAmendment.RESULTS]) cls.cp = CountryProgrammeFactory(__sequence=10) cls.cp_output = ResultFactory(result_type=cls.output_res_type)
def setUpTestData(cls): for name, _ in ResultType.NAME_CHOICES: ResultTypeFactory(name=name) cls.user = UserFactory(is_staff=True) # UNICEF staff user cls.result_type = ResultType.objects.get(name=ResultType.OUTPUT) today = datetime.date.today() cls.country_programme = CountryProgrammeFactory( wbs='0000/A0/01', from_date=datetime.date(today.year - 1, 1, 1), to_date=datetime.date(today.year + 1, 1, 1)) cls.result1 = ResultFactory( result_type=cls.result_type, country_programme=cls.country_programme, ) cls.result2 = ResultFactory(result_type=cls.result_type, country_programme=cls.country_programme) cls.v2_results_url = reverse('reports:report-result-list')
def test_result_type(self): instance = ResultTypeFactory.build(name='xyz') self.assertEqual(str(instance), u'xyz') instance = ResultTypeFactory.build(name=u'\xccsland') self.assertEqual(str(instance), u'\xccsland')
def setUpTestData(cls): cls.country = Country.objects.first() cls.result_type_output = ResultTypeFactory(name=ResultType.OUTPUT)
def setUpTestData(cls): cls.result_type_outcome = ResultTypeFactory(name=ResultType.OUTCOME) cls.result_type_output = ResultTypeFactory(name=ResultType.OUTPUT) cls.result_type_activity = ResultTypeFactory(name=ResultType.ACTIVITY)