Add apirequest unit tests

Change-Id: If8adc0003b3c3c046a44076dfab0a0268057fb49