adding unit tests for api.validate_fields