Refactor kwapi unit test

ceilometer/tests/energy/test_kwapi.py has very similar test cases,
this patch refactors those unit test code.

Change-Id: Iaedee8d6be6b58147413295b39d8d8b152caa39a
Merge "Refactor kwapi unit test"