Remove duplicate resp code in unit tests by creating a generic "get_resp" funciton.

@ozten - mind reviewing? The code that created the resp object was identical across all tests, so I created one generic function to do it.