This could be made shorter by assigning mock.MagicMock() to self.peer_listener.get_diameter_result_code directly and skipping mock_result_code, I think.