'Tests the memoize_in_request_cache decorator for both single-param and multiple-param functions.'

def test_memoize_in_request_cache(self):

    funcs_to_test = ((self.func_to_memoize, ['foo'], ['bar']), (self.multi_param_func_to_memoize, ['foo', 'foo2'], ['foo', 'foo3']))
    for (func_to_memoize, arg_list1, arg_list2) in funcs_to_test:
        self.func_to_count = MagicMock()
        self.assertFalse(self.func_to_count.called)
        func_to_memoize(*arg_list1)
        self.func_to_count.assert_called_once_with(*arg_list1)
        func_to_memoize(*arg_list1)
        self.func_to_count.assert_called_once_with(*arg_list1)
        for _ in range(10):
            func_to_memoize(*arg_list1)
            func_to_memoize(*arg_list2)
        self.assertEquals(self.func_to_count.call_count, 2)
