guardian/frontend — pull request #2070 by janua (2013-10-18 16:09:22+00:00)
Title: Facia defaults

This brings in defaults for facia.

I wanted to write tests for the `Query` class, `ParseConfig` trait and the `ParseCollection` trait, seeing as we are now 100% on mobile traffic, I think changing anything in here can be risky. So now at the very least we have some tests around it and this also makes it easier to add more.

There will be more tests around all the agents.

The biggest changes in this pull request:
- `pageFrontAgent` starts with ids inside itself (Before it was `Nil`). These come from `FaciaDefaults.defaultIds` which is just a simple list that you can add to.
- Following on from defaults above, `Query` also starts with defaults inside its agent. If you pass it an ID, it will start with the most basic (`Config`, `Collection`) tuple so that it knows where to try and look up actual `config.json` and `collection.json`. It also gets a default `contentApiQuery` in the case of looking up the JSON files failing.
- If a front is warmed up (Has items in it), then any problems getting `collection.json` will result in the chain for that collection to fail.
- If a front is not warmed up, any failure (Parse, Network) in trying to get `collection.json` will be ignored and it will still at least populate using the default `contentApiQuery`.

The only weird behaviour that can happen is around deleting the `collection.json`. If you have a `collection.json` already parsed from the past, and someone deletes the file by accident, or the permissions are incompatible, then the attempt to get this `collection.json` again will result in a `403` from S3. This means that your collection on the front page will update to only what is coming back from the automatic content API query. This is up for debate.

One nice thing about this pull request is that the IDs listed in `defaultIds` now load very quickly. It's similar to how the old mobile front worked in that everything was available almost straight away.

If you are studying this PR and would like acceleration then speak to me. :mushroom:

### Default UK
This is how `/uk`
![defaultuk](https://f.cloud.github.com/assets/445472/1361619/731228ee-380a-11e3-857d-95a31b4ca77b.png)