def setUp(self):
     self.file = open(EMPTY_FILE_PATH)
     self.url = reverse("provincial-infrastructure-project-api-list")
     self.facet_url = reverse("provincial-infrastructure-project-api-facets")
     self.fin_year = FinancialYear.objects.create(slug="2030-31")
     self.quarter = Quarter.objects.create(number=1)
     self.date = date(year=2050, month=1, day=1)
     self.irm_snapshot = IRMSnapshot.objects.create(
         financial_year=self.fin_year,
         quarter=self.quarter,
         date_taken=self.date,
         file=File(self.file),
     )
     self.project_1 = ProvInfraProject.objects.create(IRM_project_id=1)
     ProvInfraProjectSnapshot.objects.create(
         irm_snapshot=self.irm_snapshot,
         project=self.project_1,
         name="Something School",
         province="Eastern Cape",
         estimated_completion_date=date(year=2020, month=6, day=1),
     )
     self.project_2 = ProvInfraProject.objects.create(IRM_project_id=2)
     ProvInfraProjectSnapshot.objects.create(
         irm_snapshot=self.irm_snapshot,
         project=self.project_2,
         name="Project 2",
         province="Eastern Cape",
         estimated_completion_date=date(year=2020, month=6, day=1),
     )
     ProvInfraProjectIndex().reindex()
 def setUp(self):
     call_command("clear_index", "--noinput")
     self.file = open(EMPTY_FILE_PATH, "rb")
     self.url = reverse("provincial-infrastructure-project-api-list")
     self.facet_url = reverse("provincial-infrastructure-project-api-facets")
     self.fin_year = FinancialYear.objects.create(slug="2030-31")
     self.quarter = Quarter.objects.create(number=1)
     self.date = date(year=2050, month=1, day=1)
     self.irm_snapshot = IRMSnapshot.objects.create(
         financial_year=self.fin_year,
         quarter=self.quarter,
         date_taken=self.date,
         file=File(self.file),
     )
     self.project_1 = ProvInfraProject.objects.create(IRM_project_id=1)
     ProvInfraProjectSnapshot.objects.create(
         irm_snapshot=self.irm_snapshot,
         project=self.project_1,
         name="Project 1",
         main_contractor="Contractor 1",
         province="Eastern Cape",
         estimated_completion_date=self.date,
     )
     self.project_2 = ProvInfraProject.objects.create(IRM_project_id=2)
     ProvInfraProjectSnapshot.objects.create(
         irm_snapshot=self.irm_snapshot,
         project=self.project_2,
         name="Project 2",
         main_contractor="Contractor 2",
         province="Eastern Cape",
         estimated_completion_date=self.date,
     )
     ProvInfraProjectIndex().reindex()
    def setUp(self):
        call_command("clear_index", "--noinput")
        self.file = open(EMPTY_FILE_PATH, "rb")
        self.fin_year = FinancialYear.objects.create(slug="2030-31", published=True)
        self.quarter = Quarter.objects.create(number=1)
        self.date = date(year=2050, month=1, day=1)
        self.irm_snapshot = IRMSnapshot.objects.create(
            financial_year=self.fin_year,
            quarter=self.quarter,
            date_taken=self.date,
            file=File(self.file),
        )
        self.url = reverse("provincial-infrastructure-project-api-list")
        self.facet_url = reverse("provincial-infrastructure-project-api-facets")
        self.project = ProvInfraProject.objects.create(IRM_project_id=1)
        ProvInfraProjectSnapshot.objects.create(
            irm_snapshot=self.irm_snapshot,
            project=self.project,
            name="Project 1",
            estimated_completion_date=date(year=2020, month=1, day=1),
            province="Fake prov",
            department="Fake dept",
        )

        ProvInfraProjectIndex().reindex()
 def setUp(self):
     super(ProvInfraProjectSearchPageTestCase, self).setUp()
     call_command("clear_index", "--noinput")
     self.file = open(EMPTY_FILE_PATH, "rb")
     self.url = reverse("provincial-infra-project-list")
     self.wait = WebDriverWait(self.selenium, 5)
     self.fin_year = FinancialYear.objects.create(slug="2030-31")
     self.quarter = Quarter.objects.create(number=3)
     self.date = date(2050, 1, 1)
     self.irm_snapshot = IRMSnapshot.objects.create(
         financial_year=self.fin_year,
         quarter=self.quarter,
         date_taken=self.date,
         file=File(self.file),
     )
     self.project = ProvInfraProject.objects.create(IRM_project_id=123456)
     ProvInfraProjectSnapshot.objects.create(
         irm_snapshot=self.irm_snapshot,
         project=self.project,
         name="Project 123456",
         department="Health",
         province="Western Cape",
         status="Construction",
         primary_funding_source="Health Infrastructure Grant",
         estimated_completion_date=date(year=2020, month=1, day=1),
     )
     # Add ten projects
     provinces = ["Eastern Cape", "Free State"]
     for i in range(10):
         if i < 5:
             province = provinces[0]
         else:
             province = provinces[1]
         project = ProvInfraProject.objects.create(IRM_project_id=i)
         ProvInfraProjectSnapshot.objects.create(
             irm_snapshot=self.irm_snapshot,
             project=project,
             name="Project {}".format(i),
             province=province,
             estimated_completion_date=date(year=2020, month=1, day=1),
         )
     ProvInfraProjectIndex().reindex()
 def setUp(self):
     call_command("clear_index", "--noinput")
     self.file = open(EMPTY_FILE_PATH, "rb")
     self.url = reverse("provincial-infrastructure-project-api-list")
     self.facet_url = reverse("provincial-infrastructure-project-api-facets")
     self.fin_year = FinancialYear.objects.create(slug="2030-31")
     self.quarter = Quarter.objects.create(number=1)
     self.date = date(year=2050, month=1, day=1)
     self.irm_snapshot = IRMSnapshot.objects.create(
         financial_year=self.fin_year,
         quarter=self.quarter,
         date_taken=self.date,
         file=File(self.file),
     )
     self.project_1 = ProvInfraProject.objects.create(IRM_project_id=1)
     ProvInfraProjectSnapshot.objects.create(
         irm_snapshot=self.irm_snapshot,
         project=self.project_1,
         province="Eastern Cape",
         primary_funding_source="Community Library Service Grant",
         estimated_completion_date=self.date,
     )
     self.project_2 = ProvInfraProject.objects.create(IRM_project_id=2)
     ProvInfraProjectSnapshot.objects.create(
         irm_snapshot=self.irm_snapshot,
         project=self.project_2,
         province="Free State",
         primary_funding_source="Community Library Service Grant",
         estimated_completion_date=self.date,
     )
     self.project_3 = ProvInfraProject.objects.create(IRM_project_id=3)
     ProvInfraProjectSnapshot.objects.create(
         irm_snapshot=self.irm_snapshot,
         project=self.project_3,
         province="Eastern Cape",
         primary_funding_source="Equitable Share",
         estimated_completion_date=self.date,
     )
     ProvInfraProjectIndex().reindex()
 def tearDown(self):
     ProvInfraProjectIndex().clear()
     self.file.close()
    def setUp(self):
        super(ProvInfraProjectDetailPageTestCase, self).setUp()
        self.timeout = 5
        self.file = open(EMPTY_FILE_PATH)
        self.fin_year = FinancialYear.objects.create(slug="2050-51")
        self.quarter = Quarter.objects.create(number=3)
        self.date = date(year=2050, month=1, day=1)
        self.irm_snapshot = IRMSnapshot.objects.create(
            financial_year=self.fin_year,
            quarter=self.quarter,
            date_taken=self.date,
            file=File(self.file),
        )
        self.project = ProvInfraProject.objects.create(IRM_project_id=123456)
        self.project_snapshot = ProvInfraProjectSnapshot.objects.create(
            irm_snapshot=self.irm_snapshot,
            project=self.project,
            name="BLUE JUNIOR SECONDARY SCHOOL",
            # Administration
            department="Education",
            budget_programme="Programme 2 - Public Ordinary School Education",
            project_number="W/50042423/WS",
            status="Construction",
            # Location
            province="KwaZulu-Natal",
            local_municipality="Dr Nkosazana Dlamini Zuma",
            district_municipality="Harry Gwala",
            # Implementation
            program_implementing_agent="DOPW",
            principle_agent="PRINCIPLE AGENT",
            main_contractor="MAIN CONTRACTOR",
            other_parties="OTHERS",
            # Funding
            primary_funding_source="Education Infrastructure Grant",
            nature_of_investment="Upgrading and Additions",
            funding_status="Tabled",
            # Budget
            total_project_cost=680000,
            total_construction_costs=562000,
            total_professional_fees=118000,
            # Cost to date
            expenditure_from_previous_years_total=556479,
            expenditure_from_previous_years_professional_fees=118000,
            expenditure_from_previous_years_construction_costs=0,
            variation_orders=0,
            # Original Budget FY
            main_appropriation_total=337000,
            main_appropriation_construction_costs=276000,
            main_appropriation_professional_fees=61000,
            # Adjustment Budget FY
            adjustment_appropriation_total=1,
            adjustment_appropriation_construction_costs=2,
            adjustment_appropriation_professional_fees=3,
            # Overall timeline
            start_date=date(2016, 6, 13),
            estimated_completion_date=date(year=2021, month=6, day=30),
            # Construction timeline
            estimated_construction_start_date=date(2017, 2, 1),
            estimated_construction_end_date=date(2020, 12, 31),
            contracted_construction_end_date=date(2021, 1, 1),
        )

        ProvInfraProjectIndex().reindex()