Skip to content

Add test data

Marion Baumgartner edited this page Jan 28, 2020 · 1 revision

This is a step by step guide on how to add test data for development and testing.

Add a new Theme in an existing PLR

  1. in https://github.com/openoereb/pyramid_oereb/tree/master/sample_data/plr119 add a new folder with the name of the theme. Ideally this folder contains all the files needed for a theme, the easiest is probably to copy them from an existing theme and adapt them. Below is a list of files needed:

    • availabilities.json -> in this file you determine whether the theme contains data or not.
    • data_integration.json
    • document.json
    • document_reference.json
    • geometry.json -> Make sure the geometry.json contains the correct geometry as described in the config.yaml
    • legend_entry.json
    • office.json
    • public_law_restriction.json
    • public_law_restriction_document.json
    • view_service.json
  2. In the Makefile complete the rule test-db/13-fill.sql such that the json file in the newly created folder are also red to when 13-fill.sql is created. Add the following line and adapt the path if needed:

    ... \
    $(shell ls -1 sample_data/plr119/<new_theme_name>/*.json)
    
  3. Include the theme when loading the schemas in pyramid_oereb/standard/load_sample_data.py

         ...
         def load:
            """
            Performs the database operations to load the sample data.
            """
            from ...
                <new_theme_name>
            ...
            try:
                for schema, folder in [
                    ...
                    (<new_theme_name>, "<new_theme_name>"),
                ]:
            ...
    
  4. Remove the DB docker container, clean the old SQL files and serve the application.

Clone this wiki locally