Merge pull request #1068 from Ichimonji10/api-tests

Improve HTTP PUT API tests, reorganize code
Fix entity definition as per BZ 1122261

Also: improve the output of error messages in test case `LongMessageTestCase`.