Use shorter responses and configuration for specs

By simplyfing the responses the configuration for specs can be simpler too.

We're also using more generic terms instead of the ones used in Madrid's
Census API.

Co-Authored-By: Javi Martín <javim@elretirao.net>
This commit is contained in:
Senén Rodero Rodríguez
2020-10-27 23:45:50 +01:00
committed by Javi Martín
parent 3ed4bdaff8
commit dd0f56f85f
4 changed files with 47 additions and 76 deletions

View File

@@ -51,9 +51,9 @@ class RemoteCensusApi
path_value = Setting["remote_census.response.gender"]
case extract_value(path_value)
when "Varón"
when "Male", "Varón"
"male"
when "Mujer"
when "Female", "Mujer"
"female"
end
end
@@ -132,29 +132,21 @@ class RemoteCensusApi
def stubbed_valid_response
{
get_habita_datos_response: {
get_habita_datos_return: {
datos_habitante: {
item: {
fecha_nacimiento_string: "31-12-1980",
identificador_documento: "12345678Z",
descripcion_sexo: "Varón",
nombre: "José",
apellido1: "García"
}
},
datos_vivienda: {
item: {
codigo_postal: "28013",
codigo_distrito: "01"
}
}
response: {
data: {
date_of_birth: "31-12-1980",
document_number: "12345678Z",
gender: "Male",
name: "William",
surname: "Widmore",
postal_code: "28013",
district_code: "01"
}
}
}
end
def stubbed_invalid_response
{ get_habita_datos_response: { get_habita_datos_return: { datos_habitante: {}, datos_vivienda: {}}}}
{ response: { data: {}}}
end
end