Make API tests inherit from APITestCase

Group similar behaviour under a common class.
Merge pull request #1694 from elyezer/api-testcase

Make API tests inherit from APITestCase