Fixing dict ordering issue in task tests
* Whenever we compare two string representations of the same dict we should keep in mind that they may be different since standard dict doesn't provide ordering guarantees. * Modified AUTHORS Change-Id: I61badaff81b03aa001633d85ecafe846409b72a3
This commit is contained in:
		
							
								
								
									
										7
									
								
								AUTHORS
									
									
									
									
									
								
							
							
						
						
									
										7
									
								
								AUTHORS
									
									
									
									
									
								
							| @@ -3,15 +3,20 @@ Angus Salkeld <angus.salkeld@rackspace.com> | |||||||
| Christian Berendt <berendt@b1-systems.de> | Christian Berendt <berendt@b1-systems.de> | ||||||
| David C Kennedy <David C Kennedy> | David C Kennedy <David C Kennedy> | ||||||
| Dmitri Zimine <dz@stackstorm.com> | Dmitri Zimine <dz@stackstorm.com> | ||||||
|  | Ed Cranford <ed.cranford@rackspace.com> | ||||||
| Jeremy Stanley <fungi@yuggoth.org> | Jeremy Stanley <fungi@yuggoth.org> | ||||||
|  | Kevin Zheng <zhengzhenyu@huawei.com> | ||||||
| Kirill Izotov <enykeev@stackstorm.com> | Kirill Izotov <enykeev@stackstorm.com> | ||||||
| Leandro I. Costantino <leandro.i.costantino@intel.com> | Leandro I. Costantino <leandro.i.costantino@intel.com> | ||||||
|  | Limor Stotland <limor.bortman@alcatel-lucent.com> | ||||||
| Lingxian Kong <konglingxian@huawei.com> | Lingxian Kong <konglingxian@huawei.com> | ||||||
| Nikolay Mahotkin <nmakhotkin@mirantis.com> | Nikolay Mahotkin <nmakhotkin@mirantis.com> | ||||||
| Pierre-Arthur MATHIEU <pierre-arthur.mathieu@hp.com> | Pierre-Arthur MATHIEU <pierre-arthur.mathieu@hp.com> | ||||||
| Renat Akhmerov <rakhmerov@mirantis.com> | Renat Akhmerov <rakhmerov@mirantis.com> | ||||||
|  | Robert Collins <rbtcollins@hp.com> | ||||||
|  | Sirushti Murugesan <sirushti.murugesan@hp.com> | ||||||
| Tetiana Lashchova <tlashchova@mirantis.com> | Tetiana Lashchova <tlashchova@mirantis.com> | ||||||
| Thomas Goirand <zigo@debian.org> | Thomas Goirand <zigo@debian.org> | ||||||
| Timur Nurlygayanov <tnurlygayanov@mirantis.com> | Timur Nurlygayanov <tnurlygayanov@mirantis.com> | ||||||
| Winson Chan <wcchan@stackstorm.com> | Winson Chan <wcchan@stackstorm.com> | ||||||
|  | Zhenguo Niu <niuzhenguo@huawei.com> | ||||||
|   | |||||||
| @@ -58,8 +58,7 @@ class TestTasksV2(base.BaseClientV2Test): | |||||||
|             tasks.Task(self.tasks, TASK).to_dict(), |             tasks.Task(self.tasks, TASK).to_dict(), | ||||||
|             task.to_dict() |             task.to_dict() | ||||||
|         ) |         ) | ||||||
|         mock.assert_called_once_with( |         mock.assert_called_once_with(URL_TEMPLATE_ID % TASK['id']) | ||||||
|             URL_TEMPLATE_ID % TASK['id']) |  | ||||||
|  |  | ||||||
|     def test_rerun(self): |     def test_rerun(self): | ||||||
|         mock = self.mock_http_put(content=TASK) |         mock = self.mock_http_put(content=TASK) | ||||||
| @@ -71,9 +70,15 @@ class TestTasksV2(base.BaseClientV2Test): | |||||||
|             task.to_dict() |             task.to_dict() | ||||||
|         ) |         ) | ||||||
|  |  | ||||||
|         mock.assert_called_once_with( |         self.assertEqual(1, mock.call_count) | ||||||
|             URL_TEMPLATE_ID % TASK['id'], |         self.assertEqual(URL_TEMPLATE_ID % TASK['id'], mock.call_args[0][0]) | ||||||
|             json.dumps({'reset': True, 'state': 'RUNNING', 'id': TASK['id']}) |         self.assertDictEqual( | ||||||
|  |             { | ||||||
|  |                 'reset': True, | ||||||
|  |                 'state': 'RUNNING', | ||||||
|  |                 'id': TASK['id'] | ||||||
|  |             }, | ||||||
|  |             json.loads(mock.call_args[0][1]) | ||||||
|         ) |         ) | ||||||
|  |  | ||||||
|     def test_rerun_no_reset(self): |     def test_rerun_no_reset(self): | ||||||
| @@ -86,7 +91,13 @@ class TestTasksV2(base.BaseClientV2Test): | |||||||
|             task.to_dict() |             task.to_dict() | ||||||
|         ) |         ) | ||||||
|  |  | ||||||
|         mock.assert_called_once_with( |         self.assertEqual(1, mock.call_count) | ||||||
|             URL_TEMPLATE_ID % TASK['id'], |         self.assertEqual(URL_TEMPLATE_ID % TASK['id'], mock.call_args[0][0]) | ||||||
|             json.dumps({'reset': False, 'state': 'RUNNING', 'id': TASK['id']}) |         self.assertDictEqual( | ||||||
|  |             { | ||||||
|  |                 'reset': False, | ||||||
|  |                 'state': 'RUNNING', | ||||||
|  |                 'id': TASK['id'] | ||||||
|  |             }, | ||||||
|  |             json.loads(mock.call_args[0][1]) | ||||||
|         ) |         ) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Renat Akhmerov
					Renat Akhmerov