test_realm_export.py: Remove unnecessary variable assignments.

The `queue_data` variable is an intermediate step that's unnecessary.
Instead, the values from the queue event are assigned dierectly.

Also, the `worker` variable is not worth an assignment as it is only
referenced a single time per test case.
This commit is contained in:
Wyatt Hoodes 2019-05-26 10:06:38 +01:00 committed by Tim Abbott
parent d32ce0ed7e
commit 55ff497099
1 changed files with 4 additions and 8 deletions

View File

@ -25,12 +25,10 @@ class RealmExportTest(ZulipTestCase):
with patch('zerver.views.public_export.queue_json_publish') as mock_publish:
result = self.client_post('/json/export/realm')
queue_data = mock_publish.call_args_list[0][0]
worker = mock_publish.call_args_list[0][0][0]
self.assert_json_success(result)
mock_publish.assert_called_once()
event = queue_data[1]
self.assertEqual(worker, 'deferred_work')
event = mock_publish.call_args_list[0][0][1]
self.assertEqual(mock_publish.call_args_list[0][0][0], 'deferred_work')
self.assertEqual(event['realm_id'], 1)
self.assertEqual(event['user_profile_id'], 5)
self.assertEqual(event['type'], 'realm_exported')
@ -52,12 +50,10 @@ class RealmExportTest(ZulipTestCase):
with patch('zerver.views.public_export.queue_json_publish') as mock_publish:
result = self.client_post('/json/export/realm')
queue_data = mock_publish.call_args_list[0][0]
worker = mock_publish.call_args_list[0][0][0]
self.assert_json_success(result)
mock_publish.assert_called_once()
event = queue_data[1]
self.assertEqual(worker, 'deferred_work')
event = mock_publish.call_args_list[0][0][1]
self.assertEqual(mock_publish.call_args_list[0][0][0], 'deferred_work')
self.assertEqual(event['realm_id'], 1)
self.assertEqual(event['user_profile_id'], 5)
self.assertEqual(event['type'], 'realm_exported')