Exemple #1
0
    def test_search_child_including_children(self):
        parent_org, child_org, parent_dataset, child_dataset = \
            create_fixtures()

        app = self._get_test_app()
        response = app.get(url='/organization/child_org?include_children=True')

        search_results = scrape_search_results(response)
        eq(search_results, set(('child', )))
    def test_home_page(self):
        (
            parent_org,
            child_org,
            parent_dataset,
            child_dataset,
        ) = create_fixtures()

        app = self._get_test_app()
        app.get(url="/")
    def test_search_parent_excluding_children(self):
        (
            parent_org,
            child_org,
            parent_dataset,
            child_dataset,
        ) = create_fixtures()

        app = self._get_test_app()
        response = app.get(url="/organization/parent_org")

        search_results = scrape_search_results(response)
        eq(search_results, set(("parent", )))
    def test_package_search_is_unaffected(self):
        parent_org, child_org, parent_dataset, child_dataset = \
            create_fixtures()

        # package_search API is unaffected by ckanext-hierarchy (only searches
        # via the front-end are affected)
        package_search_result = helpers.call_action('package_search',
                                                    fq='owner_org:{}'.format(
                                                        parent_org['id']))
        search_results = \
            [result['name'] for result in package_search_result['results']]

        eq(set(search_results), set(('parent', )))
    def test_search_child_including_children(self):
        (
            parent_org,
            child_org,
            parent_dataset,
            child_dataset,
        ) = create_fixtures()

        app = self._get_test_app()
        response = app.get(
            url="/organization/child_org?ext_hierarchy_enable_tree_search=True"
        )

        search_results = scrape_search_results(response)
        eq(search_results, set(("child", )))
    def test_package_search_is_unaffected(self):
        (
            parent_org,
            child_org,
            parent_dataset,
            child_dataset,
        ) = create_fixtures()

        # package_search API is unaffected by ckanext-hierarchy (only searches
        # via the front-end are affected)
        package_search_result = helpers.call_action(
            "package_search", fq="owner_org:{}".format(parent_org["id"])
        )
        search_results = [
            result["name"] for result in package_search_result["results"]
        ]

        eq(set(search_results), set(("parent",)))