Refactored api unit tests for DRY

Reduced repetition of mock.patch calls

Change-Id: Ic636b2b04b4d352d6092f2305ce9c03e4c556857
Closes-Bug: #1260417