Пример #1
0
    def setUp(self):
        super().setUp()
        consultee = FactoryFloor.ConsultationRoleFactory()
        org = consultee.organization
        org.grouping.add(1)  # make sure it will load as an indigenous org
        instructions = FactoryFloor.ConsultationInstructionFactory(organization=org)

        status = models.Status.objects.first()
        sector = FactoryFloor.SectorFactory()
        entry_type = models.EntryType.objects.first()
        for x in range(1, 10):
            e = FactoryFloor.EntryFactory(status=status)
            e.organizations.add(org)
            e.sectors.add(sector)
        activate('en')

        self.test_urls = [
            reverse_lazy('ihub:consultation_log_pdf') + "?fy=None&sectors=None&orgs=None&statuses=None&entry_types=None&report_title=Test&from_date=None&to_date=None",
            reverse_lazy('ihub:consultation_log_xlsx') + "?fy=None&sectors=None&orgs=None&statuses=None&entry_types=None&report_title=Test&from_date=None&to_date=None",
            reverse_lazy('ihub:summary_xlsx') + "?fy=None&sectors=None&orgs=None&from_date=None&to_date=None",
            reverse_lazy('ihub:summary_pdf') + "?fy=None&sectors=None&orgs=None&from_date=None&to_date=None",
            reverse_lazy('ihub:capacity_xlsx') + "?fy=None&sectors=None&orgs=None&from_date=None&to_date=None",
            reverse_lazy('ihub:report_q', args=[org.id]),
            reverse_lazy('ihub:consultation_instructions_pdf'),
            reverse_lazy('ihub:consultation_instructions_xlsx'),
        ]
        self.view = views.ConsultationLogPDFTemplateView
Пример #2
0
 def setUp(self):
     super().setUp()
     self.instance1 = FactoryFloor.OrganizationFactory()
     self.instance2 = FactoryFloor.OrganizationMemberFactory()
     self.test_url = reverse_lazy('ihub:consultee_new', args=[self.instance1.pk, self.instance2.pk, ])
     self.expected_template = 'shared_models/generic_popout_form.html'
     self.user = self.get_and_login_user(in_group="ihub_edit")
Пример #3
0
    def test_submit(self):
        org = FactoryFloor.OrganizationFactory()
        grouping = ml_models.Grouping.objects.filter(is_indigenous=True).first()
        org.grouping.add(grouping)

        data = FactoryFloor.EntryFactory.get_valid_data()
        data["organizations"] = [org.id]
        self.assert_success_url(self.test_url, data=data, user=self.user)
Пример #4
0
 def setUp(self):
     super().setUp()
     self.instance = FactoryFloor.EntryPersonFactory()
     self.test_url = reverse_lazy('ihub:ep_delete',
                                  args=[
                                      self.instance.pk,
                                  ])
     self.user = self.get_and_login_user(in_group="ihub_edit")
Пример #5
0
 def setUp(self):
     super().setUp()
     self.instance = FactoryFloor.EntryPersonFactory()
     self.test_url = reverse_lazy('ihub:ep_edit', args=[
         self.instance.pk,
     ])
     self.expected_template = 'ihub/entry_person_form_popout.html'
     self.user = self.get_and_login_user(in_group="ihub_edit")
Пример #6
0
 def setUp(self):
     super().setUp()
     self.instance = FactoryFloor.PersonFactory()
     self.test_url = reverse_lazy('ihub:person_edit', args=[self.instance.pk, ])
     self.test_url1 = reverse_lazy('ihub:person_edit_pop', args=[self.instance.pk, ])
     self.expected_template = 'ihub/form.html'
     self.expected_template1 = 'shared_models/generic_popout_form.html'
     self.user = self.get_and_login_user(in_group="ihub_edit")
Пример #7
0
 def setUp(self):
     super().setUp()
     self.instance = FactoryFloor.PersonFactory()
     self.test_url = reverse_lazy('ihub:person_detail',
                                  args=[
                                      self.instance.pk,
                                  ])
     self.expected_template = 'ihub/person_detail.html'
     self.user = self.get_and_login_user()
Пример #8
0
 def setUp(self):
     super().setUp()
     self.instance = FactoryFloor.ConsultationInstructionFactory()
     self.test_url = reverse_lazy('ihub:instruction_edit',
                                  args=[
                                      self.instance.pk,
                                  ])
     self.expected_template = 'ihub/instruction_form.html'
     self.user = self.get_and_login_user(in_group="ihub_edit")
Пример #9
0
 def setUp(self):
     super().setUp()
     self.instance = FactoryFloor.PersonFactory()
     self.test_url = reverse_lazy('ihub:person_delete',
                                  args=[
                                      self.instance.pk,
                                  ])
     self.expected_template = 'ihub/confirm_delete.html'
     self.user = self.get_and_login_user(in_group="ihub_admin")
Пример #10
0
 def setUp(self):
     super().setUp()
     self.instance = FactoryFloor.OrganizationMemberFactory()
     self.test_url = reverse_lazy('ihub:member_delete',
                                  args=[
                                      self.instance.pk,
                                  ])
     self.expected_template = 'shared_models/generic_popout_confirm_delete.html'
     self.user = self.get_and_login_user(in_group="ihub_admin")
Пример #11
0
 def setUp(self):
     super().setUp()
     self.instance = FactoryFloor.OrganizationMemberFactory()
     self.test_url = reverse_lazy('ihub:member_edit',
                                  args=[
                                      self.instance.pk,
                                  ])
     self.expected_template = 'ihub/member_form_popout.html'
     self.user = self.get_and_login_user(in_group="ihub_edit")
Пример #12
0
 def setUp(self):
     super().setUp()
     self.instance = FactoryFloor.ConsultationRoleFactory()
     self.test_url = reverse_lazy('ihub:consultee_edit',
                                  args=[
                                      self.instance.pk,
                                  ])
     self.expected_template = 'shared_models/generic_popout_form.html'
     self.user = self.get_and_login_user(in_group="ihub_edit")
Пример #13
0
    def test_valid_data(self):
        org = FactoryFloor.OrganizationFactory()
        grouping = ml_models.Grouping.objects.filter(is_indigenous=True).first()
        org.grouping.add(grouping)

        data = FactoryFloor.EntryFactory.get_valid_data()
        print(data)
        data["organizations"] = [org.id]
        data["sectors"] = [data["sectors"]]
        data["regions"] = [data["regions"]]

        self.assert_form_valid(self.Form, data=data)

        del data["regions"]
        del data["sectors"]
        del data["organizations"]
        self.assert_form_invalid(self.Form, data=data)
Пример #14
0
 def setUp(self):
     super().setUp()
     self.instance = i_factory.OrganizationMemberFactory()
     self.test_url = reverse_lazy('maret:member_edit', args=[self.instance.pk, ])
     self.expected_template = 'maret/member_form_popout.html'
     self.user = self.get_and_login_user(in_group="maret_author")
Пример #15
0
    def setUp(self):
        super().setUp()
        self.starter_dicts = [
            {
                "model": ml_models.Sector,
                "url_name": "delete_sector",
                "view": views.SectorHardDeleteView
            },
            {
                "model": models.Status,
                "url_name": "delete_status",
                "view": views.StatusHardDeleteView
            },
            {
                "model": models.EntryType,
                "url_name": "delete_entry_type",
                "view": views.EntryTypeHardDeleteView
            },
            {
                "model": models.FundingPurpose,
                "url_name": "delete_funding_purpose",
                "view": views.FundingPurposeHardDeleteView
            },
            {
                "model": ml_models.Reserve,
                "url_name": "delete_reserve",
                "view": views.ReserveHardDeleteView
            },
            {
                "model": ml_models.Nation,
                "url_name": "delete_nation",
                "view": views.NationHardDeleteView
            },
            {
                "model": models.FundingProgram,
                "url_name": "delete_program",
                "view": views.FundingProgramHardDeleteView
            },
            {
                "model": ml_models.RelationshipRating,
                "url_name": "delete_rating",
                "view": views.RelationshipRatingHardDeleteView
            },
        ]
        self.test_dicts = list()

        self.user = self.get_and_login_user(in_group="ihub_admin")
        for d in self.starter_dicts:
            new_d = d
            m = d["model"]
            if m == ml_models.Sector:
                obj = FactoryFloor.SectorFactory()
            elif m == ml_models.RelationshipRating:
                obj = m.objects.create(name=faker.catch_phrase(),
                                       level=faker.pyint(1, 100))
            else:
                obj = m.objects.create(name=faker.catch_phrase())
            new_d["obj"] = obj
            new_d["url"] = reverse_lazy("ihub:" + d["url_name"],
                                        kwargs={"pk": obj.id})
            self.test_dicts.append(new_d)
Пример #16
0
 def setUp(self):
     super().setUp()
     self.instance = i_factory.PersonFactory()
     self.test_url = reverse_lazy('maret:person_detail', args=[self.instance.pk, ])
     self.expected_template = 'maret/person_detail.html'
     self.user = self.get_and_login_user(in_group="maret_user")
Пример #17
0
 def setUp(self):
     super().setUp()
     self.instance = FactoryFloor.PersonFactory()
     self.test_url = reverse_lazy('ihub:person_list')
     self.expected_template = 'ihub/list.html'
     self.user = self.get_and_login_user()