Пример #1
0
    def test_type(self) -> None:
        with app.app_context():
            with app.test_request_context():
                app.preprocess_request()  # type: ignore
                actor_type = Type.get_hierarchy('Actor actor relation')
                dimension_type = Type.get_hierarchy('Dimensions')
                historical_type = Type.get_hierarchy('Historical place')
                sex_type = Type.get_hierarchy('Sex')
                place = insert_entity('Home', 'place')
                place.link('P2', g.types[dimension_type.subs[0]], '46')
                location = place.get_linked_entity_safe('P53')
                location.link('P89', g.types[historical_type.subs[0]])
            rv: Any = self.app.get(url_for('view', id_=historical_type.subs[0]))
            assert b'Historical place' in rv.data
            rv = self.app.get(url_for('type_index'))
            assert b'Actor actor relation' in rv.data
            rv = self.app.get(
                url_for('insert', class_='type', origin_id=actor_type.id))
            assert b'Actor actor relation' in rv.data
            data = {
                'name': 'My secret type',
                'name_inverse': 'Do I look inverse?',
                'description': 'Very important!'}
            rv = self.app.post(
                url_for('insert', class_='type', origin_id=actor_type.id),
                data=data)
            type_id = rv.location.split('/')[-1]
            rv = self.app.get(url_for('update', id_=type_id))
            assert b'My secret type' in rv.data and b'Super' in rv.data
            self.app.post(
                url_for('insert', class_='type', origin_id=sex_type.id),
                data=data)
            rv = self.app.post(
                url_for('update', id_=type_id),
                data=data,
                follow_redirects=True)
            assert b'Changes have been saved.' in rv.data

            # Insert and continue
            data['continue_'] = 'yes'
            rv = self.app.post(
                url_for('insert', class_='type', origin_id=actor_type.id),
                data=data,
                follow_redirects=True)
            assert b'An entry has been created' in rv.data
            data['continue_'] = ''

            # Forbidden system type
            rv = self.app.post(
                url_for('update', id_=actor_type.id),
                data=data,
                follow_redirects=True)
            assert b'Forbidden' in rv.data

            # Update with self as root
            data[str(actor_type.id)] = type_id
            rv = self.app.post(
                url_for('update', id_=type_id),
                data=data,
                follow_redirects=True)
            assert b'Type can't have itself as super' in rv.data

            # Update with sub as root
            rv = self.app.post(
                url_for('insert', class_='type', origin_id=actor_type.id),
                data=data)
            sub_type_id = rv.location.split('/')[-1].replace('type#tab-', '')
            data[str(actor_type.id)] = sub_type_id
            rv = self.app.post(
                url_for('update', id_=type_id),
                data=data,
                follow_redirects=True)
            assert b'Type can't have a sub as super' in rv.data

            # Custom type
            rv = self.app.get(
                url_for('view', id_=sex_type.id),
                follow_redirects=True)
            assert b'Male' in rv.data

            # Administrative unit
            admin_unit_id = Type.get_hierarchy('Administrative unit').id
            rv = self.app.get(
                url_for('view', id_=admin_unit_id), follow_redirects=True)
            assert b'Austria' in rv.data
            rv = self.app.post(
                url_for(
                    'insert',
                    class_='administrative_unit',
                    origin_id=g.types[admin_unit_id].subs[0]),
                data={'name': 'admin unit'},
                follow_redirects=True)
            assert b'An entry has been created' in rv.data

            # Value type
            rv = self.app.get(
                url_for('view', id_=dimension_type.id),
                follow_redirects=True)
            assert b'Height' in rv.data
            rv = self.app.get(url_for('view', id_=dimension_type.subs[0]))
            assert b'Unit' in rv.data
            rv = self.app.get(url_for('update', id_=dimension_type.subs[0]))
            assert b'Dimensions' in rv.data

            # Test parent value type view after creating a sub subtype
            rv = self.app.post(
                url_for(
                    'insert',
                    class_='type',
                    origin_id=dimension_type.subs[0]),
                data={
                    'name': "Sub sub type",
                    dimension_type.id: dimension_type.subs[0]},
                follow_redirects=True)
            assert b'An entry has been created' in rv.data
            rv = self.app.get(url_for('view', id_=dimension_type.subs[0]))
            assert b'Sub sub type' in rv.data

            # Untyped entities
            with app.test_request_context():
                app.preprocess_request()  # type: ignore
                actor = Entity.insert('person', 'Connor MacLeod')
            rv = self.app.get(url_for('show_untyped_entities', id_=sex_type.id))
            assert b'Connor MacLeod' in rv.data
            with app.test_request_context():
                app.preprocess_request()  # type: ignore
                actor.link('P2', g.types[sex_type.subs[0]])
            rv = self.app.get(url_for('show_untyped_entities', id_=sex_type.id))
            assert b'No entries' in rv.data

            # Delete
            rv = self.app.get(
                url_for('type_delete', id_=actor_type.id),
                follow_redirects=True)
            assert b'Forbidden' in rv.data
            rv = self.app.get(
                url_for('type_delete', id_=sub_type_id),
                follow_redirects=True)
            assert b'The entry has been deleted.' in rv.data
Пример #2
0
    def test_api(self) -> None:
        with app.app_context():  # type: ignore
            with app.test_request_context():
                app.preprocess_request()  # type: ignore
                place = insert_entity('Nostromos',
                                      'place',
                                      description='That is the Nostromos')
                if not place:  # Needed for Mypy
                    return  # pragma: no cover

                # Adding Dates to place
                place.begin_from = '2018-01-31'
                place.begin_to = '2018-03-01'
                place.begin_comment = 'Begin of the Nostromos'
                place.end_from = '2019-01-31'
                place.end_to = '2019-03-01'
                place.end_comment = 'Destruction of the Nostromos'
                place.update()

                location = place.get_linked_entity_safe('P53')
                Gis.add_example_geom(location)

                # Adding Type Settlement
                place.link('P2', Node.get_hierarchy('Place'))

                # Adding Alias
                alias = insert_entity('Cargo hauler', 'appellation')
                place.link('P1', alias)

                # Adding External Reference
                external_reference = insert_entity('https://openatlas.eu',
                                                   'external_reference')
                external_reference.link('P67',
                                        place,
                                        description='OpenAtlas Website')

                # Adding feature to place
                feature = insert_entity('Feature', 'feature', place)

                # Adding stratigraphic to place
                insert_entity('Strato', 'stratigraphic_unit', feature)

                # Adding Administrative Unit Node
                unit_node = Node.get_hierarchy('Administrative unit')

                # Adding File to place
                file = insert_entity('Datei', 'file')
                file.link('P67', place)
                file.link('P2', g.nodes[Node.get_hierarchy('License').subs[0]])

                # Adding Value Type
                value_type = Node.get_hierarchy('Dimensions')
                place.link('P2', Entity.get_by_id(value_type.subs[0]), '23.0')

                # Adding Geonames
                geonames = Entity.get_by_id(
                    ReferenceSystem.get_by_name('GeoNames').id)
                precision_id = Node.get_hierarchy(
                    'External reference match').subs[0]
                geonames.link('P67',
                              place,
                              description='2761369',
                              type_id=precision_id)

            # Test LinkedPlaces output
            self.maxDiff = None
            rv = self.app.get(url_for('api.entity', id_=place.id))
            self.assertDictEqual(rv.get_json(),
                                 api_data.api_linked_place_template)

            # Test Geojson output
            rv = self.app.get(
                url_for('api.entity', id_=place.id, format='geojson'))
            self.assertDictEqual(rv.get_json(), api_data.api_geojson_template)

            # ---Content---

            # /api/0.2/classes/
            rv = self.app.get(url_for('api.class_mapping'))
            self.assertAlmostEqual(rv.get_json(), ClassMapping.mapping)

            # /api/0.2/content/
            rv = self.app.get(url_for('api.content', lang='de'))
            self.assertDictEqual(rv.get_json(), api_data.api_content_de)
            rv = self.app.get(url_for('api.content', lang='en', download=True))
            self.assertDictEqual(rv.get_json(), api_data.api_content_en)

            # /api/0.2/geometric_entities/
            rv = self.app.get(url_for('api.geometric_entities'))
            self.assertDictEqual(rv.get_json(),
                                 api_data.api_geometries_template)
            rv = self.app.get(url_for('api.geometric_entities', download=True))
            self.assertDictEqual(rv.get_json(),
                                 api_data.api_geometries_template)
            rv = self.app.get(url_for('api.geometric_entities', count=True))
            assert b'1' in rv.data
            rv = self.app.get(
                url_for('api.geometric_entities',
                        geometry='gisLineAll',
                        count=True))
            assert b'0' in rv.data

            # /api/0.2/overview_count/
            rv = self.app.get(url_for('api.overview_count'))
            self.assertAlmostEqual(rv.get_json(), api_data.api_overview_count)

            # /api/0.2/overview_count/
            rv = self.app.get(url_for('api.system_class_count'))
            self.assertDictEqual(rv.get_json(),
                                 api_data.api_system_class_count)

            # ---Nodes---

            # /api/0.2/node_entities/
            rv = self.app.get(url_for('api.node_entities', id_=unit_node.id))
            self.assertDictEqual(rv.get_json(), api_data.api_node_entities)
            rv = self.app.get(
                url_for('api.node_entities', id_=unit_node.id, download=True))
            self.assertDictEqual(rv.get_json(), api_data.api_node_entities)
            rv = self.app.get(
                url_for('api.node_entities', id_=unit_node.id, count=True))
            assert b'6' in rv.data

            # /api/0.2/node_entities_all/
            rv = self.app.get(
                url_for('api.node_entities_all', id_=unit_node.id))
            self.assertDictEqual(rv.get_json(), api_data.api_node_entities_all)
            rv = self.app.get(
                url_for('api.node_entities_all',
                        id_=unit_node.id,
                        download=True))
            self.assertDictEqual(rv.get_json(), api_data.api_node_entities_all)
            rv = self.app.get(
                url_for('api.node_entities_all', id_=unit_node.id, count=True))
            assert b'8' in rv.data

            # # /api/0.2/node_overview/
            # rv = self.app.get(url_for('api.node_overview'))
            # self.assertDictEqual(rv.get_json(), api_data.api_node_overview)
            # rv = self.app.get(url_for('api.node_overview', download=True))
            # self.assertDictEqual(rv.get_json(), api_data.api_node_overview)

            # /api/0.2/subunit/
            rv = self.app.get(url_for('api.subunit', id_=place.id))
            self.assertDictEqual(rv.get_json(), api_data.api_subunit)
            rv = self.app.get(
                url_for('api.subunit', id_=place.id, download=True))
            self.assertDictEqual(rv.get_json(), api_data.api_subunit)
            rv = self.app.get(url_for('api.subunit', id_=place.id, count=True))
            assert b'1' in rv.data

            # /api/0.2/subunit_hierarchy/
            rv = self.app.get(url_for('api.subunit_hierarchy', id_=place.id))
            self.assertDictEqual(rv.get_json(), api_data.api_subunit_hierarchy)
            rv = self.app.get(
                url_for('api.subunit_hierarchy', id_=place.id, download=True))
            self.assertDictEqual(rv.get_json(), api_data.api_subunit_hierarchy)
            rv = self.app.get(
                url_for('api.subunit_hierarchy', id_=place.id, count=True))
            assert b'2' in rv.data

            # /api/0.2/type_tree/
            # rv = self.app.get(url_for('api.type_tree'))
            # self.assertDictEqual(rv.get_json(), api_data.api_type_tree)
            # rv = self.app.get(url_for('api.type_tree', download=True))
            # self.assertDictEqual(rv.get_json(), api_data.api_type_tree)

            # ---Entity---
            # /api/0.2/code/
            rv = self.app.get(url_for('api.code', code='reference'))
            self.assertDictEqual(rv.get_json(), api_data.api_code_reference)
            rv = self.app.get(
                url_for('api.code', code='reference', format='geojson'))
            self.assertDictEqual(rv.get_json(),
                                 api_data.api_code_reference_geojson)
            rv = self.app.get(
                url_for('api.code', code='reference', download=True))
            self.assertDictEqual(rv.get_json(), api_data.api_code_reference)
            rv = self.app.get(url_for('api.code', code='place', count=True))
            assert b'3' in rv.data
            rv = self.app.get(
                url_for('api.code',
                        code='place',
                        show='geometry',
                        limit=2,
                        sort='desc',
                        first=feature.id))
            self.assertDictEqual(rv.get_json(),
                                 api_data.api_code_place_first_sort_show_limit)
            rv = self.app.get(
                url_for('api.code',
                        code='place',
                        limit=10,
                        sort='desc',
                        column='name',
                        filter='or|name|like|Nostromos'))
            self.assertDictEqual(
                rv.get_json(),
                api_data.api_code_place_limit_sort_column_filter)
            rv = self.app.get(
                url_for('api.code',
                        code='place',
                        filter='or|id|eq|' + str(place.id)))
            self.assertDictEqual(rv.get_json(),
                                 api_data.api_code_place_filter_id)
            rv = self.app.get(
                url_for('api.code',
                        code='place',
                        filter='or|begin_from|ge|2018-1-1'))
            self.assertDictEqual(rv.get_json(),
                                 api_data.api_code_place_filter_time)
            rv = self.app.get(
                url_for('api.code', code='reference', export='csv'))
            assert b'https://openatlas.eu' in rv.data
            rv = self.app.get(
                url_for('api.entities_linked_to_entity', id_=place.id))
            self.assertDictEqual(rv.get_json(),
                                 api_data.api_entities_linked_entity)

            # Path Tests
            rv = self.app.get(url_for('api.class', class_code='E31'))
            assert b'https://openatlas.eu' in rv.data
            rv = self.app.get(
                url_for('api.class', class_code='E31', format='geojson'))
            assert b'https://openatlas.eu' in rv.data
            rv = self.app.get(
                url_for('api.class', class_code='E31', download=True))
            assert b'https://openatlas.eu' in rv.data
            rv = self.app.get(
                url_for('api.class', class_code='E18', export='csv'))
            assert b'Nostromos' in rv.data
            rv = self.app.get(url_for('api.latest', latest=10))
            assert b'Datei' in rv.data

            rv = self.app.get(url_for('api.latest', count=True, latest=2))
            assert b'2' in rv.data

            rv = self.app.get(
                url_for('api.system_class', system_class='appellation'))
            assert b'Cargo hauler' in rv.data
            rv = self.app.get(
                url_for('api.system_class',
                        system_class='appellation',
                        format='geojson'))
            assert b'Cargo hauler' in rv.data

            rv = self.app.get(url_for('api.type_entities', id_=unit_node.id))
            assert b'Austria' in rv.data
            rv = self.app.get(
                url_for('api.type_entities_all', id_=unit_node.id))
            assert b'Austria' in rv.data
            rv = self.app.get(
                url_for('api.query',
                        entities=place.id,
                        classes='E18',
                        items='place'))
            assert b'Nostromos' in rv.data
            rv = self.app.get(
                url_for('api.query',
                        entities=place.id,
                        classes='E18',
                        items='place',
                        format='geojson'))
            assert b'Nostromos' in rv.data

            # Path test with download
            rv = self.app.get(
                url_for('api.entity', id_=place.id, download=True))
            assert b'Nostromos' in rv.data
            rv = self.app.get(url_for('api.latest', latest=1, download=True))
            assert b'Datei' in rv.data

            rv = self.app.get(
                url_for('api.system_class',
                        system_class='appellation',
                        download=True))
            assert b'Cargo hauler' in rv.data

            rv = self.app.get(
                url_for('api.query', classes='E31', download=True))
            assert b'https://openatlas.eu' in rv.data

            rv = self.app.get(url_for('api.overview_count', download=True))
            assert b'systemClass' in rv.data
            rv = self.app.get(url_for('api.class_mapping', download=True))
            assert b'systemClass' in rv.data

            # Path with export
            rv = self.app.get(url_for('api.entity', id_=place.id,
                                      export='csv'))
            assert b'Nostromos' in rv.data

            rv = self.app.get(
                url_for('api.system_class', system_class='place',
                        export='csv'))
            assert b'Nostromos' in rv.data

            # Testing Subunit

            # Parameter: filter

            rv = self.app.get(
                url_for('api.class',
                        class_code='E18',
                        filter='or|name|like|Nostr'))
            assert b'Nostromos' in rv.data

            # Parameter: last
            rv = self.app.get(
                url_for('api.class', class_code='E18', last=place.id))
            assert b'entities' in rv.data
            # Parameter: first
            rv = self.app.get(
                url_for('api.class', class_code='E18', first=place.id))
            assert b'entities' in rv.data

            # Parameter: show
            rv = self.app.get(
                url_for('api.class', class_code='E31', show='types'))
            assert b'https://openatlas.eu' in rv.data
            rv = self.app.get(
                url_for('api.class', class_code='E18', show='when'))
            assert b'Nostromos' in rv.data
            rv = self.app.get(
                url_for('api.class', class_code='E31', show='none'))
            assert b'https://openatlas.eu' in rv.data

            # Parameter: count
            rv = self.app.get(
                url_for('api.class', class_code='E31', count=True))
            assert b'2' in rv.data

            rv = self.app.get(
                url_for('api.system_class',
                        system_class='appellation',
                        count=True))
            assert b'1' in rv.data

            rv = self.app.get(
                url_for('api.query',
                        entities=place.id,
                        classes='E18',
                        codes='place'))
            assert b'Nostromos' in rv.data
            rv = self.app.get(
                url_for('api.query',
                        entities=place.id,
                        classes='E18',
                        codes='place',
                        count=True))
            assert b'7' in rv.data
Пример #3
0
    def test_image(self) -> None:
        app.config['IMAGE_SIZE']['tmp'] = '1'
        with app.app_context():
            with app.test_request_context():
                app.preprocess_request()  # type: ignore
                place = insert_entity('Nostromos',
                                      'place',
                                      description='That is the Nostromos')
                logo = \
                    pathlib.Path(app.root_path) \
                    / 'static' / 'images' / 'layout' / 'logo.png'

            # Resizing through UI insert
            with open(logo, 'rb') as img:
                rv = self.app.post(url_for('insert',
                                           class_='file',
                                           origin_id=place.id),
                                   data={
                                       'name': 'OpenAtlas logo',
                                       'file': img
                                   },
                                   follow_redirects=True)
            assert b'An entry has been created' in rv.data

            with app.test_request_context():
                app.preprocess_request()  # type: ignore
                files = Entity.get_by_class('file')
                file_id = files[0].id

            # Set and unset as main image
            self.app.get(url_for('set_profile_image',
                                 id_=file_id,
                                 origin_id=place.id),
                         follow_redirects=True)

            # Delete through UI
            rv = self.app.get(url_for('index', view='file', delete_id=file_id))
            assert b'The entry has been deleted' in rv.data

            # Create entities for file
            with app.test_request_context():
                app.preprocess_request()  # type: ignore
                file_pathless = insert_entity('Pathless_File', 'file')

                file = insert_entity('Test_File', 'file')
                file.link('P2', g.types[Type.get_hierarchy('License').subs[0]])
                file_name = f'{file.id}.jpeg'
                src_png = \
                    pathlib.Path(app.root_path) \
                    / 'static' / 'images' / 'layout' / 'logo.png'
                dst_png = \
                    pathlib.Path(app.config['UPLOAD_DIR'] / file_name)
                copyfile(src_png, dst_png)

                file2 = insert_entity('Test_File2', 'file')
                file2.link('P2',
                           g.types[Type.get_hierarchy('License').subs[0]])
                file2_name = f'{file2.id}.jpeg'
                src2_png = \
                    pathlib.Path(app.root_path) \
                    / 'static' / 'images' / 'layout' / 'logo.png'
                dst2_png = pathlib.Path(app.config['UPLOAD_DIR'] / file2_name)
                copyfile(src2_png, dst2_png)

                file_py = insert_entity('Test_Py', 'file')
                file_name_py = f'{file_py.id}.py'
                src_py = pathlib.Path(app.root_path) / 'views' / 'index.py'
                dst_py = pathlib.Path(app.config['UPLOAD_DIR'] / file_name_py)
                copyfile(src_py, dst_py)

                # Exception
                safe_resize_image(file2.id, '.png', size="???")
                display_profile_image(file_pathless)

            # Resizing images (don't change order!)
            rv = self.app.get(url_for('view', id_=file.id))
            assert b'Test_File' in rv.data
            rv = self.app.get(url_for('view', id_=file_py.id))
            assert b'No preview available' in rv.data
            rv = self.app.get(url_for('view', id_=file_pathless.id))
            assert b'Missing file' in rv.data
            rv = self.app.get(url_for('index', view='file'))
            assert b'Test_File' in rv.data

            # Display file
            rv = self.app.get(url_for('display_file', filename=file_name))
            assert b'\xff' in rv.data
            rv = self.app.get(
                url_for('display_file',
                        filename=file_name,
                        size=app.config['IMAGE_SIZE']['thumbnail']))
            assert b'\xff' in rv.data
            rv = self.app.get(
                url_for('display_file',
                        filename=file_name,
                        size=app.config['IMAGE_SIZE']['table']))
            assert b'\xff' in rv.data
            rv = self.app.get(
                url_for('display_file',
                        filename=file_name_py,
                        size=app.config['IMAGE_SIZE']['table']))
            assert b'404' in rv.data

            # Make directory if not exist
            rv = self.app.get(url_for('view', id_=file.id))
            assert b'Test_File' in rv.data

            # Exception
            app.config['IMAGE_SIZE']['tmp'] = '<'
            rv = self.app.get(url_for('view', id_=file.id))
            assert b'Test_File' in rv.data
            app.config['IMAGE_SIZE']['tmp'] = '1'

            rv = self.app.get(url_for('admin_resize_images'),
                              follow_redirects=True)
            assert b'Images were created' in rv.data
            rv = self.app.get(url_for('admin_delete_orphaned_resized_images'),
                              follow_redirects=True)
            assert b'Resized orphaned images were deleted' in rv.data

            rv = self.app.get(url_for('index', view='file', delete_id=file.id))
            assert b'The entry has been deleted' in rv.data
            rv = self.app.get(url_for('index', view='file',
                                      delete_id=file2.id))
            assert b'The entry has been deleted' in rv.data

            shutil.rmtree(
                pathlib.Path(app.config['RESIZED_IMAGES'] /
                             app.config['IMAGE_SIZE']['tmp']))

            dst_py.unlink()
            del app.config['IMAGE_SIZE']['tmp']
Пример #4
0
    def test_api(self) -> None:
        pass
        with app.app_context():  # type: ignore
            with app.test_request_context():
                app.preprocess_request()  # type: ignore
                place = insert_entity('Nostromos',
                                      'place',
                                      description='That is the Nostromos')
                if not place:
                    return  # pragma: no cover

                # Adding Dates to place
                place.begin_from = '2018-01-31'
                place.begin_to = '2018-03-01'
                place.begin_comment = 'Begin of the Nostromos'
                place.end_from = '2019-01-31'
                place.end_to = '2019-03-01'
                place.end_comment = 'Destruction of the Nostromos'

                location = place.get_linked_entity_safe('P53')
                Gis.add_example_geom(location)

                # Adding Type Settlement
                place.link('P2', Node.get_hierarchy('Place'))

                # Adding Alias
                alias = insert_entity('Cargo hauler', 'appellation')
                place.link('P1', alias)

                # Adding External Reference
                external_reference = insert_entity('https://openatlas.eu',
                                                   'external_reference')
                external_reference.link('P67',
                                        place,
                                        description='OpenAtlas Website')

                # Adding feature to place
                feature = insert_entity('Feature', 'feature', place)

                # Adding stratigraphic to place
                strati = insert_entity('Strato', 'stratigraphic_unit', feature)

                # Adding Administrative Unit Node
                unit_node = Node.get_hierarchy('Administrative unit')

                # Adding File to place
                file = insert_entity('Datei', 'file')
                file.link('P67', place)
                file.link('P2', Node.get_hierarchy('License'))

                # Adding Value Type
                value_type = Node.get_hierarchy('Dimensions')
                place.link('P2', Entity.get_by_id(value_type.subs[0]), '23.0')

                # Adding Geonames
                geonames = Entity.get_by_id(
                    ReferenceSystem.get_by_name('GeoNames').id)
                precision_id = Node.get_hierarchy(
                    'External reference match').subs[0]
                geonames.link('P67',
                              place,
                              description='2761369',
                              type_id=precision_id)

            # Path Tests
            rv = self.app.get(url_for('usage'))
            assert b'message' in rv.data
            rv = self.app.get(url_for('latest', latest=10))
            assert b'Datei' in rv.data
            rv = self.app.get(url_for('latest', count=True, latest=1))
            assert b'1' in rv.data
            rv = self.app.get(url_for('entity', id_=place.id))
            assert b'Nostromos' in rv.data
            rv = self.app.get(url_for('code', code='reference'))
            assert b'openatlas' in rv.data
            rv = self.app.get(
                url_for('system_class', system_class='appellation'))
            assert b'Cargo hauler' in rv.data
            rv = self.app.get(url_for('class', class_code='E31'))
            assert b'https://openatlas.eu' in rv.data
            rv = self.app.get(url_for('node_entities', id_=unit_node.id))
            assert b'Austria' in rv.data
            rv = self.app.get(url_for('node_entities_all', id_=unit_node.id))
            assert b'Austria' in rv.data
            rv = self.app.get(
                url_for('query',
                        entities=place.id,
                        classes='E18',
                        items='place'))
            assert b'Nostromos' in rv.data
            rv = self.app.get(url_for('content', lang='de'))
            assert b'intro' in rv.data
            rv = self.app.get(url_for('overview_count'))
            assert b'systemClass' in rv.data
            rv = self.app.get(url_for('class_mapping'))
            assert b'systemClass' in rv.data
            rv = self.app.get(url_for('node_overview'))
            assert b'Actor' in rv.data
            rv = self.app.get(url_for('type_tree'))
            assert b'type_tree' in rv.data

            # Path test with download
            rv = self.app.get(url_for('entity', id_=place.id, download=True))
            assert b'Nostromos' in rv.data
            rv = self.app.get(url_for('latest', latest=1, download=True))
            assert b'Datei' in rv.data
            rv = self.app.get(url_for('code', code='reference', download=True))
            assert b'https://openatlas.eu' in rv.data
            rv = self.app.get(
                url_for('system_class',
                        system_class='appellation',
                        download=True))
            assert b'Cargo hauler' in rv.data
            rv = self.app.get(url_for('class', class_code='E31',
                                      download=True))
            assert b'https://openatlas.eu' in rv.data
            rv = self.app.get(
                url_for('node_entities', id_=unit_node.id, download=True))
            assert b'Austria' in rv.data
            rv = self.app.get(
                url_for('node_entities_all', id_=unit_node.id, download=True))
            assert b'Austria' in rv.data
            rv = self.app.get(url_for('query', classes='E31', download=True))
            assert b'https://openatlas.eu' in rv.data
            rv = self.app.get(url_for('content', lang='de', download=True))
            assert b'intro' in rv.data
            rv = self.app.get(url_for('overview_count', download=True))
            assert b'systemClass' in rv.data
            rv = self.app.get(url_for('class_mapping', download=True))
            assert b'systemClass' in rv.data
            rv = self.app.get(url_for('node_overview', download=True))
            assert b'Actor' in rv.data

            # Path with export
            rv = self.app.get(url_for('entity', id_=place.id, export='csv'))
            assert b'Nostromos' in rv.data
            rv = self.app.get(url_for('class', class_code='E18', export='csv'))
            assert b'Nostromos' in rv.data
            rv = self.app.get(
                url_for('system_class', system_class='place', export='csv'))
            assert b'Nostromos' in rv.data
            rv = self.app.get(url_for('code', code='reference', export='csv'))
            assert b'https://openatlas.eu' in rv.data

            # Testing Subunit
            rv = self.app.get(url_for('subunit', id_=place.id))
            assert b'Feature' in rv.data and b'Strato' not in rv.data
            rv = self.app.get(url_for('subunit', id_=place.id, download=True))
            assert b'Feature' in rv.data and b'Strato' not in rv.data
            rv = self.app.get(url_for('subunit', id_=place.id, count=True))
            assert b'1' in rv.data
            rv = self.app.get(url_for('subunit_hierarchy', id_=place.id))
            assert b'Strato' in rv.data
            rv = self.app.get(
                url_for('subunit_hierarchy', id_=place.id, download=True))
            assert b'Strato' in rv.data
            rv = self.app.get(
                url_for('subunit_hierarchy', id_=place.id, count=True))
            assert b'2' in rv.data

            # Parameter: filter
            rv = self.app.get(
                url_for('code',
                        code='place',
                        limit=10,
                        sort='desc',
                        column='name',
                        filter='or|name|like|Nostromos'))
            assert b'Nostromos' in rv.data
            rv = self.app.get(url_for('code', code='reference'))
            assert b'openatlas' in rv.data
            rv = self.app.get(
                url_for('class', class_code='E18',
                        filter='or|name|like|Nostr'))
            assert b'Nostromos' in rv.data
            rv = self.app.get(
                url_for('code',
                        code='place',
                        filter='or|id|eq|' + str(place.id)))
            assert b'Nostromos' in rv.data
            rv = self.app.get(
                url_for('code',
                        code='place',
                        filter='or|begin_from|ge|2018-1-1'))
            assert b'Nostromos' in rv.data

            # Parameter: last
            rv = self.app.get(url_for('class', class_code='E18',
                                      last=place.id))
            assert b'entities' in rv.data
            # Parameter: first
            rv = self.app.get(
                url_for('class', class_code='E18', first=place.id))
            assert b'entities' in rv.data

            # Parameter: show
            rv = self.app.get(url_for('class', class_code='E31', show='types'))
            assert b'https://openatlas.eu' in rv.data
            rv = self.app.get(url_for('class', class_code='E18', show='when'))
            assert b'Nostromos' in rv.data
            rv = self.app.get(url_for('class', class_code='E31', show='none'))
            assert b'https://openatlas.eu' in rv.data

            # Parameter: count
            rv = self.app.get(url_for('class', class_code='E31', count=True))
            assert b'2' in rv.data
            rv = self.app.get(url_for('code', code='place', count=True))
            assert b'3' in rv.data
            rv = self.app.get(
                url_for('system_class', system_class='appellation',
                        count=True))
            assert b'1' in rv.data

            rv = self.app.get(
                url_for('query',
                        entities=place.id,
                        classes='E18',
                        codes='place'))
            assert b'Nostromos' in rv.data
            rv = self.app.get(
                url_for('query',
                        entities=place.id,
                        classes='E18',
                        codes='place',
                        count=True))
            assert b'7' in rv.data
            rv = self.app.get(
                url_for('node_entities', id_=unit_node.id, count=True))
            assert b'6' in rv.data
            rv = self.app.get(
                url_for('node_entities_all', id_=unit_node.id, count=True))
            assert b'8' in rv.data