Ejemplo n.º 1
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")
Ejemplo n.º 2
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)
Ejemplo n.º 3
0
 def setUp(self):
     super().setUp()
     self.instance = FactoryFloor.OrganizationFactory()
     self.test_url = reverse_lazy('ihub:org_edit',
                                  args=[
                                      self.instance.pk,
                                  ])
     self.expected_template = 'ihub/form.html'
     self.user = self.get_and_login_user(in_group="ihub_edit")
Ejemplo n.º 4
0
 def setUp(self):
     super().setUp()
     self.instance = FactoryFloor.OrganizationFactory()
     self.test_url = reverse_lazy('ihub:org_detail',
                                  args=[
                                      self.instance.pk,
                                  ])
     self.expected_template = 'ihub/organization_detail.html'
     self.user = self.get_and_login_user()
Ejemplo n.º 5
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)