Pull request for /sites api tests

When writing the tests a few bugs have been discovered. See ticket #49,
ticket #50, #51 and #52.