diff options
| author | Joshua Harlow <harlowja@yahoo-inc.com> | 2015-01-26 13:56:34 -0800 |
|---|---|---|
| committer | Joshua Harlow <harlowja@gmail.com> | 2015-01-29 22:59:54 -0800 |
| commit | 99b92aed5de1d0868266ce63dec4f3b0e4a636d1 (patch) | |
| tree | de073564a434495975da661bf66393e145aad1b0 /taskflow/tests | |
| parent | 5f71412402ad94eba5cb741dd1e9cdbdc6a6c3bc (diff) | |
| download | taskflow-99b92aed5de1d0868266ce63dec4f3b0e4a636d1.tar.gz | |
Add and use a nicer kombu message formatter
Since the kombu message object that is recieved has
no useful __str__ or __repr__ and on reception and processing
we should the message (and the delivery tag) it is nice to have
a more useful formatting of that message for debugging and
such (where more detail about the messages are quite useful
to see).
Change-Id: I6730b10122a5de1a0a074525931f312fbd97b8c0
Diffstat (limited to 'taskflow/tests')
| -rw-r--r-- | taskflow/tests/unit/worker_based/test_server.py | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/taskflow/tests/unit/worker_based/test_server.py b/taskflow/tests/unit/worker_based/test_server.py index 7a77e8d..1fb8aa5 100644 --- a/taskflow/tests/unit/worker_based/test_server.py +++ b/taskflow/tests/unit/worker_based/test_server.py @@ -154,7 +154,7 @@ class TestServer(test.MockTestCase): s = self.server(reset_master_mock=True) s._reply(True, self.reply_to, self.task_uuid) - self.assertEqual(self.master_mock.mock_calls, [ + self.master_mock.assert_has_calls([ mock.call.Response(pr.FAILURE), mock.call.proxy.publish(self.response_inst_mock, self.reply_to, correlation_id=self.task_uuid) @@ -195,7 +195,7 @@ class TestServer(test.MockTestCase): mock.call.proxy.publish(self.response_inst_mock, self.reply_to, correlation_id=self.task_uuid) ] - self.assertEqual(master_mock_calls, self.master_mock.mock_calls) + self.master_mock.assert_has_calls(master_mock_calls) def test_process_request(self): # create server and process request @@ -211,7 +211,7 @@ class TestServer(test.MockTestCase): mock.call.proxy.publish(self.response_inst_mock, self.reply_to, correlation_id=self.task_uuid) ] - self.assertEqual(self.master_mock.mock_calls, master_mock_calls) + self.master_mock.assert_has_calls(master_mock_calls) @mock.patch("taskflow.engines.worker_based.server.LOG.warn") def test_process_request_parse_message_failure(self, mocked_exception): @@ -219,8 +219,6 @@ class TestServer(test.MockTestCase): request = self.make_request() s = self.server(reset_master_mock=True) s._process_request(request, self.message_mock) - - self.assertEqual(self.master_mock.mock_calls, []) self.assertTrue(mocked_exception.called) @mock.patch.object(failure.Failure, 'from_dict') @@ -245,7 +243,7 @@ class TestServer(test.MockTestCase): self.reply_to, correlation_id=self.task_uuid) ] - self.assertEqual(master_mock_calls, self.master_mock.mock_calls) + self.master_mock.assert_has_calls(master_mock_calls) @mock.patch.object(failure.Failure, 'to_dict') def test_process_request_endpoint_not_found(self, to_mock): @@ -266,7 +264,7 @@ class TestServer(test.MockTestCase): self.reply_to, correlation_id=self.task_uuid) ] - self.assertEqual(self.master_mock.mock_calls, master_mock_calls) + self.master_mock.assert_has_calls(master_mock_calls) @mock.patch.object(failure.Failure, 'to_dict') def test_process_request_execution_failure(self, to_mock): @@ -288,7 +286,7 @@ class TestServer(test.MockTestCase): self.reply_to, correlation_id=self.task_uuid) ] - self.assertEqual(self.master_mock.mock_calls, master_mock_calls) + self.master_mock.assert_has_calls(master_mock_calls) @mock.patch.object(failure.Failure, 'to_dict') def test_process_request_task_failure(self, to_mock): @@ -312,7 +310,7 @@ class TestServer(test.MockTestCase): self.reply_to, correlation_id=self.task_uuid) ] - self.assertEqual(self.master_mock.mock_calls, master_mock_calls) + self.master_mock.assert_has_calls(master_mock_calls) def test_start(self): self.server(reset_master_mock=True).start() @@ -321,7 +319,7 @@ class TestServer(test.MockTestCase): master_mock_calls = [ mock.call.proxy.start() ] - self.assertEqual(self.master_mock.mock_calls, master_mock_calls) + self.master_mock.assert_has_calls(master_mock_calls) def test_wait(self): server = self.server(reset_master_mock=True) @@ -333,7 +331,7 @@ class TestServer(test.MockTestCase): mock.call.proxy.start(), mock.call.proxy.wait() ] - self.assertEqual(self.master_mock.mock_calls, master_mock_calls) + self.master_mock.assert_has_calls(master_mock_calls) def test_stop(self): self.server(reset_master_mock=True).stop() @@ -342,4 +340,4 @@ class TestServer(test.MockTestCase): master_mock_calls = [ mock.call.proxy.stop() ] - self.assertEqual(self.master_mock.mock_calls, master_mock_calls) + self.master_mock.assert_has_calls(master_mock_calls) |
