API tests to check for the return codes

Some API tests were just checking whether a particular request would
raise a generic exception (webtest.app.AppError) or not, and this is not
enough, the API tests should make sure that the request will raise an
exception (expect_errors=True) and also check if the HTTP code returned
is appropriated for that error.

The FIXME left at test_remove_fail() is going to be fixed by a following
patch.

Closes-Bug: #1275812
Change-Id: I156749b3de0627c6d322192c397bbfe33919cf2d
Merge "API tests to check for the return codes"