galatea-associates / fuse-test-data-gen

Repository for the Galatea internal data generator tool, used for generating domain data for POCs
0 stars 0 forks source link

Validate dummy fields in config #212

Open WilfGala opened 4 years ago

WilfGala commented 4 years ago

Issue Description

Dummy fields are currently generated as specified in config.json:

"dummy_fields": [
    {
        "data_type": "string",
        "data_length": 10,
        "field_count": 10
    },
    {
        "data_type": "numeric",
        "data_length": 10,
        "field_count": 10
    }
]

These attribute values should be validated as part of the config validation phase.

Design

config_validator.py

Add a validate_dummy_fields method to config_validator.py and call it inside the validate method as part of the errors list. This method should return a list of error messages for any invalid fields in the dummy_fields section each domain object.

config_validator_test.py

A test_dummy_field_failure method should be added to config_validator_test.py to ensure invalid values are caught.

Documentation Changes

Add docstring to validate_dummy_fields and test_dummy_field_failure

Test Evidence

The newly written test should pass as expected, and running python src/app.py with invalid dummy field values in the config should display the expected error message(s).

Validation in Develop

N/A