Improve unit tests for API.

Initial framework for adding API unit tests,
imported from Ceilometer.

Partially implements bp:api-v1-impl

Change-Id: Ia840e23799ea36f29f91434062c0309e683681d8