sanger/S2Mapper — pull request #61 by benoitmangili (2013-04-08 02:03:59+00:00)
Title: New test config

Big update regarding the test_config, which can now offer a simple(r) mechanism to update the responses after a PUT or a POST.

test_config now expects testData files with the following format :
```json
[
{
"description":"that's not true, this line is not required",
"calls": [
{
"method":...
"url":...
"response":...
...
},
{...},
]
},
{
"calls": [ ... ]
}
]
```
It's an array of stages, which each contains possible calls.

The test_config will hash all the calls in the current stage, and will use the result to provide responses to ajax calls. When the call is POST or PUT, and after the response, the stage will be incremented (if possible). The calls in the new stage will be MERGED to the current hash.

Also, two extra calls are automagically added to the hash, to response to searches with no result.

The config.log has been slightly updated to take one optional level as first argument, and a variable number of arguments after.

The config.logLevel allows to filter the config.log calls.

The config provides two methods: LoadTestData() and cummulativeLoadingTestDataInFirstStage().
The first one erases the content of the hash, while the other one doesn't...