Skip to content

Commit

Permalink
[tests] divide projections file and update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
lgrd committed Apr 6, 2023
1 parent 7febd4a commit b6ca757
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 28 deletions.
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
{
"projectionsList": [
{
"id": "EPSG:4326",
"parameters": "+proj=longlat +datum=WGS84 +no_defs"
},
{
"id": "EPSG:2154",
"parameters": "+proj=lcc +lat_1=49 +lat_2=44 +lat_0=46.5 +lon_0=3 +x_0=700000 +y_0=6600000 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs"
Expand Down
8 changes: 8 additions & 0 deletions docker/config/projections/world.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"projectionsList": [
{
"id": "EPSG:4326",
"parameters": "+proj=longlat +datum=WGS84 +no_defs"
}
]
}
2 changes: 1 addition & 1 deletion documentation/configuration/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ On peut trouver un [exemple](../../docker/config/cors.json) de ce fichier au for

Le fichier *service.json* indique un dossier de projections. Ce dossier peut contenir plusieurs fichiers JSON. Ces fichiers seront lus, indépendamment de leur extension, pour obtenir les informations nécessaires permettant à [PROJ4](http://proj4js.org/) d'effectuer des reprojections.

On peut trouver un [exemple](../../docker/config/projections/projection.json) de ce fichier et le [modèle](./projections/projection_model.yaml) au format YAML.
On peut trouver un [exemple](../../docker/config/projections/world.json) de ce fichier et le [modèle](./projections/projection_model.yaml) au format YAML.

## Les sources

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,97 +14,91 @@ Feature: Road2 configuration

Scenario: [projection.json] JSON vide
Given a valid configuration
And without attribute "projectionsList" in "projection.json" projection
And without attribute "projectionsList" in "world.json" projection
When I test the configuration
Then the configuration analysis should give an exit code 1
Then the server log should contain "La fichier des projections ne contient pas de liste"

Scenario: [projection.json] projectionsList absent
Given a valid configuration
And without attribute "projectionsList" in "projection.json" projection
And with parameter "test" for attribute "projections" in "projection.json" projection
And without attribute "projectionsList" in "world.json" projection
And with parameter "test" for attribute "projections" in "world.json" projection
When I test the configuration
Then the configuration analysis should give an exit code 1
Then the server log should contain "La fichier des projections ne contient pas de liste"

Scenario: [projection.json] projectionsList different
Given a valid configuration
And with parameter "test" for attribute "projectionsList" in "projection.json" projection
And with parameter "test" for attribute "projectionsList" in "world.json" projection
When I test the configuration
Then the configuration analysis should give an exit code 1
Then the server log should contain "L'attribut projectionsList de la configuration n'est pas un tableau"

Scenario: [projection.json] projectionsList est un tableau vide
Given a valid configuration
And without attribute "projectionsList.[6]" in "projection.json" projection
And without attribute "projectionsList.[5]" in "projection.json" projection
And without attribute "projectionsList.[4]" in "projection.json" projection
And without attribute "projectionsList.[3]" in "projection.json" projection
And without attribute "projectionsList.[2]" in "projection.json" projection
And without attribute "projectionsList.[1]" in "projection.json" projection
And without attribute "projectionsList.[0]" in "projection.json" projection
And without attribute "projectionsList.[0]" in "world.json" projection
When I test the configuration
Then the configuration analysis should give an exit code 1
Then the server log should contain "L'attribut projectionsList de la configuration est un tableau vide"

Scenario: [projection.json] une configuration de projection vide
Given a valid configuration
And without attribute "projectionsList.[0].id" in "projection.json" projection
And without attribute "projectionsList.[0].parameters" in "projection.json" projection
And without attribute "projectionsList.[0].id" in "world.json" projection
And without attribute "projectionsList.[0].parameters" in "world.json" projection
When I test the configuration
Then the configuration analysis should give an exit code 1
Then the server log should contain "La configuration de la projection n'a pas d'id"

Scenario: [projection.json] une configuration de projection sans id
Given a valid configuration
And without attribute "projectionsList.[0].id" in "projection.json" projection
And without attribute "projectionsList.[0].id" in "world.json" projection
When I test the configuration
Then the configuration analysis should give an exit code 1
Then the server log should contain "La configuration de la projection n'a pas d'id"

Scenario: [projection.json] une configuration de projection sans parametre
Given a valid configuration
And without attribute "projectionsList.[0].parameters" in "projection.json" projection
And without attribute "projectionsList.[0].parameters" in "world.json" projection
When I test the configuration
Then the configuration analysis should give an exit code 1
Then the server log should contain "La configuration de la projection n'a pas de parametres"

Scenario: [projection.json] une configuration de projection différentes
Given a valid configuration
And with parameter "test" for attribute "projectionsList.[0]" in "projection.json" projection
And with parameter "test" for attribute "projectionsList.[0]" in "world.json" projection
When I test the configuration
Then the configuration analysis should give an exit code 1
Then the server log should contain "La configuration de la projection n'a pas d'id"

Scenario: [projection.json] projection.id différent pour une projection inutilisée dans les topologies
Given a valid configuration
And with parameter "test" for attribute "projectionsList.[2].id" in "projection.json" projection
And with parameter "test" for attribute "projectionsList.[2].id" in "france.json" projection
When I test the configuration
Then the configuration analysis should give an exit code 0

Scenario: [projection.json] projection.id différent pour une projection utilisée dans les topologies
Given a valid configuration
And with parameter "test" for attribute "projectionsList.[0].id" in "projection.json" projection
And with parameter "test" for attribute "projectionsList.[0].id" in "world.json" projection
When I test the configuration
Then the configuration analysis should give an exit code 1

Scenario: [projection.json] projection.id vide
Given a valid configuration
And with parameter "" for attribute "projectionsList.[2].id" in "projection.json" projection
And with parameter "" for attribute "projectionsList.[2].id" in "france.json" projection
When I test the configuration
Then the configuration analysis should give an exit code 1
Then the server log should contain "La configuration de la projection n'a pas d'id"

#TODO : Voir si on peut mieux vérifier
Scenario: [projection.json] projection.parameters différent
Given a valid configuration
And with parameter "test" for attribute "projectionsList.[0].parameters" in "projection.json" projection
And with parameter "test" for attribute "projectionsList.[0].parameters" in "world.json" projection
When I test the configuration
Then the configuration analysis should give an exit code 0

Scenario: [projection.json] projection.parameters vide
Given a valid configuration
And with parameter "" for attribute "projectionsList.[0].parameters" in "projection.json" projection
And with parameter "" for attribute "projectionsList.[0].parameters" in "world.json" projection
When I test the configuration
Then the configuration analysis should give an exit code 1
Then the server log should contain "La configuration de la projection n'a pas de parametres"
4 changes: 2 additions & 2 deletions test/unit/mocha/geography/testsProjectionManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ describe('Test de la classe ProjectionManager', function() {
describe('Vérification d\'un fichier de projections', function() {

let projManager = new ProjectionManager();
let file = "/home/docker/app/test/unit/mocha/config/projections/projection.json";
let file = "/home/docker/app/test/unit/mocha/config/projections/france.json";

it('checkProjectionFile()', function() {
assert.equal(projManager.checkProjectionFile(file), true);
Expand Down Expand Up @@ -107,7 +107,7 @@ describe('Test de la classe ProjectionManager', function() {
describe('Chargement d\'un fichier de projections', function() {

let projManager = new ProjectionManager();
let file = "/home/docker/app/test/unit/mocha/config/projections/projection.json";
let file = "/home/docker/app/test/unit/mocha/config/projections/france.json";

it('loadProjectionFile()', function() {
assert.equal(projManager.loadProjectionFile(file), true);
Expand Down

0 comments on commit b6ca757

Please sign in to comment.