I think the role of this function is to take in some expected results and a mocked callback from the HSS, mock out a Diameter response, and assert that the return value of the mocked callback matches the expected result - but it's not very clear. It would be nice to have a comment explaining the role of deferred and inner_deferred and the overall purpose of the function.