alphagov/cloudflare-configure — pull request #5 by dcarley (2014-11-03 14:56:55+00:00)
Title: Improve request tests

#### Test for CF.MakeRequest() success

We weren't previously testing that MakeRequest() would return no errors if
the response indicated success.

#### Test non-JSON response bodies for CF.MakeRequest()

Put something in the body of the existing test for a response with a status
code of 500. Create an additional test for a 200 response with the same
non-JSON body, which will fail to parse.

#### Match specific errors from CF.MakeRequest()

To ensure that we get the error that we're expecting. This highlights one
case where we're getting the wrong kind of error - a parse error instead of
"Response body indicated failure" - which I'll fix in a subsequent commit.

These are quite verbose and could be tidied up with more "public" error
objects at a later date.

#### Use correct errors schema in test

Per `CloudFlareError` this field should be a slice of maps, not a slice of
strings. Otherwise we get a parse error instead of an error about the
semantic contents of the body.