How to get diff from python `mock.assert_called_with ()`?

When called unittest.TestCase.assertEqual()on two complex dictionaries, I get a good diff.

Is there a way to get diff from Python 2.7 mock.Mock.assert_called_with? I am testing calls that take some dict parameters with complex values, and it is very difficult to understand what the problem is when one of them simply does not have a boolean value.

eg.

AssertionError: Expected call: post('http://cloud-atlas.cogolo.net/api/executions', auth=('cloudatlas', 'cloudatlas'), data={'environment': 'hadoop', 'source': 'repo', 'output_path': 'hdfs://namenode-01/user/erose/testing', 'production': True, 'input_path': 'hdfs://namenode-01/foo/bar', 'name': 'linecount', 'mrcloud_options': '{"mrcloud_option_A": "foobar", "hadoop_user_name": "erose"}', 'details': '{"path_to_file": "linecount.py", "parameters": {}, "branch": "master", "repo_name": "example_repo"}'}, headers={'X-COGO-CLOUDATLAS-USER': 'erose'})
Actual call: post('http://cloud-atlas.cogolo.net/api/executions', auth=('cloudatlas', 'cloudatlas'), data={'input_path': 'hdfs://namenode-01/foo/bar', 'name': 'linecount', 'environment': 'hadoop', 'source': 'repo', 'output_path': 'hdfs://namenode-01/user/erose/testing', 'details': '{"path_to_file": "linecount.py", "parameters": {}, "branch": "master", "repo_name": "example_repo"}', 'mrcloud_options': '{"mrcloud_option_A": "foobar", "hadoop_user_name": "erose"}'}, headers={'X-COGO-CLOUDATLAS-USER': 'erose'})
+4
source share

Source: https://habr.com/ru/post/1653930/


All Articles