コード例 #1
0
ファイル: test_synchronizers.py プロジェクト: azizur77/etools
 def test_process_indicators_add_result(self):
     """Check that result is added to indicator, if found"""
     result = ResultFactory(
         result_type=self.result_type_output,
         wbs="1234/56/78/90A/BCD"
     )
     indicator = IndicatorFactory(
         code="WBS",
         name="NAME",
         baseline="BLINE",
         target="Target",
     )
     response = self.adapter.process_indicators([self.data])
     self.assertEqual(response, {
         "details": "Created Skipped 0\n"
         "Updated Skipped 0\n"
         "Created 0\n"
         "Indicators Updated to Active 0\n"
         "Indicators Updated to Inactive 0\n"
         "Updated 1",
         "total_records": 1,
         "processed": 1
     })
     indicator_updated = Indicator.objects.get(pk=indicator.pk)
     self.assertEqual(indicator_updated.result, result)
コード例 #2
0
ファイル: test_synchronizers.py プロジェクト: azizur77/etools
 def test_process_indicators_wbs_not_found(self):
     """Check that NO update happens if result wbs differs and NOT found
     update is skipped
     """
     result = ResultFactory(
         result_type=self.result_type_output,
         wbs="1234/56/78/90A/EFG"
     )
     IndicatorFactory(
         code="WBS",
         name="NAME",
         baseline="BLINE",
         target="Target",
         result=result
     )
     response = self.adapter.process_indicators([self.data])
     self.assertEqual(response, {
         "details": "Created Skipped 0\n"
         "Updated Skipped 1\n"
         "Created 0\n"
         "Indicators Updated to Active 0\n"
         "Indicators Updated to Inactive 0\n"
         "Updated 0",
         "total_records": 1,
         "processed": 0
     })
     result_updated = Result.objects.get(pk=result.pk)
     self.assertEqual(result_updated.wbs, result.wbs)
コード例 #3
0
 def test_process_indicators_result_not_found(self):
     """Check that NO update happens if no result and result wbs NOT found
     update is skipped
     """
     indicator = IndicatorFactory(
         code="WBS",
         name="NAME",
         baseline="BLINE",
         target="Target",
     )
     response = self.adapter.process_indicators([self.data])
     self.assertEqual(
         response, {
             "details":
             "Created Skipped 0\n"
             "Updated Skipped 0\n"
             "Created 0\n"
             "Indicators Updated to Active 0\n"
             "Indicators Updated to Inactive 0\n"
             "Updated 0",
             "total_records":
             1,
             "processed":
             0
         })
     indicator_updated = Indicator.objects.get(pk=indicator.pk)
     self.assertIsNone(indicator_updated.result)
コード例 #4
0
 def setUpTestData(cls):
     cls.unicef_staff = UserFactory(is_staff=True)
     cls.result = ResultFactory()
     cls.indicator = IndicatorFactory(result=cls.result)
     cls.url = reverse("reports:result-indicator-list",
                       args=[cls.result.pk])
コード例 #5
0
 def setUp(self):
     super(TestInterventionIndicatorModelExport, self).setUp()
     self.indicator = IndicatorFactory(name="Name", code="Code")
     self.link = InterventionResultLinkFactory(
         intervention=self.intervention, )
     self.link.ram_indicators.add(self.indicator)
コード例 #6
0
 def setUp(self):
     super(TestInterventionResultModelExport, self).setUp()
     indicator = IndicatorFactory()
     self.link = InterventionResultLinkFactory(
         intervention=self.intervention, )
     self.link.ram_indicators.add(indicator)
コード例 #7
0
ファイル: test_models.py プロジェクト: adi130987/etools
    def test_indicator(self):
        instance = IndicatorFactory.build(name='xyz', active=True)
        self.assertEqual(str(instance), u'xyz  ')

        instance = IndicatorFactory.build(name=u'\xccsland', active=True)
        self.assertEqual(str(instance), u'\xccsland  ')