Beispiel #1
0
 def test_location(self):
     loc_type = LocationType(domain=self.domain, name='type')
     loc_type.save()
     self.addCleanup(loc_type.delete)
     location = make_location(domain=self.domain,
                              site_code='doc_info_test',
                              name='doc_info_test',
                              location_type='type')
     location.save()
     self.addCleanup(location.delete)
     self._test_doc(location.location_id, "Location")
Beispiel #2
0
    def setUpClass(cls):
        super().setUpClass()

        cls.domain = 'test'
        cls.domain_obj = create_domain(cls.domain)

        set_toggle(FILTERED_BULK_USER_DOWNLOAD.slug,
                   cls.domain,
                   True,
                   namespace=NAMESPACE_DOMAIN)

        location_type = LocationType(domain=cls.domain, name='phony')
        location_type.save()

        cls.some_location = make_loc('1',
                                     'some_location',
                                     type=location_type,
                                     domain=cls.domain_obj.name)

        cls.admin_user = WebUser.create(
            cls.domain_obj.name,
            '*****@*****.**',
            'badpassword',
            None,
            None,
            email='*****@*****.**',
            first_name='Edith',
            last_name='Wharton',
            is_admin=True,
        )

        cls.admin_user_with_location = WebUser.create(
            cls.domain_obj.name,
            '*****@*****.**',
            'badpassword',
            None,
            None,
            email='*****@*****.**',
            first_name='Edith',
            last_name='Wharton',
            is_admin=True,
        )
        cls.admin_user_with_location.set_location(cls.domain,
                                                  cls.some_location)

        populate_user_index([
            cls.admin_user_with_location,
            cls.admin_user,
        ])
    def setUpClass(cls):
        super(LocationHierarchyTest, cls).setUpClass()
        domain = "a-song-of-ice-and-fire"
        domain_obj = create_domain(domain)
        continent_location_type = LocationType(
            domain=domain,
            name="continent",
            code="continent",
        )
        continent_location_type.save()
        kingdom_location_type = LocationType(
            domain=domain,
            name="kingdom",
            code="kingdom",
            parent_type=continent_location_type,
        )
        kingdom_location_type.save()
        city_location_type = LocationType(
            domain=domain,
            name="city",
            code="city",
            parent_type=kingdom_location_type,
        )
        city_location_type.save()

        continent = SQLLocation(
            domain=domain,
            name="Westeros",
            location_type=continent_location_type,
            site_code="westeros",
        )
        continent.save()
        kingdom = SQLLocation(
            domain=domain,
            name="The North",
            location_type=kingdom_location_type,
            parent=continent,
            site_code="the_north",
        )
        kingdom.save()
        city = SQLLocation(
            domain=domain,
            name="Winterfell",
            location_type=city_location_type,
            parent=kingdom,
            site_code="winterfell",
        )
        city.save()

        cls.domain_obj = domain_obj
        cls.domain = domain
        cls.continent = continent
        cls.kingdom = kingdom
        cls.city = city
    def setUpClass(cls):
        super(LocationHierarchyTest, cls).setUpClass()
        domain = "a-song-of-ice-and-fire"
        domain_obj = create_domain(domain)
        continent_location_type = LocationType(
            domain=domain,
            name="continent",
            code="continent",
        )
        continent_location_type.save()
        kingdom_location_type = LocationType(
            domain=domain,
            name="kingdom",
            code="kingdom",
            parent_type=continent_location_type,
        )
        kingdom_location_type.save()
        city_location_type = LocationType(
            domain=domain,
            name="city",
            code="city",
            parent_type=kingdom_location_type,
        )
        city_location_type.save()

        continent = SQLLocation(
            domain=domain,
            name="Westeros",
            location_type=continent_location_type,
            site_code="westeros",
        )
        continent.save()
        kingdom = SQLLocation(
            domain=domain,
            name="The North",
            location_type=kingdom_location_type,
            parent=continent,
            site_code="the_north",
        )
        kingdom.save()
        city = SQLLocation(
            domain=domain,
            name="Winterfell",
            location_type=city_location_type,
            parent=kingdom,
            site_code="winterfell",
        )
        city.save()

        cls.domain_obj = domain_obj
        cls.domain = domain
        cls.continent = continent
        cls.kingdom = kingdom
        cls.city = city