mirror of https://github.com/zulip/zulip.git
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:
parent
d32ce0ed7e
commit
55ff497099
|
@ -25,12 +25,10 @@ class RealmExportTest(ZulipTestCase):
|
||||||
|
|
||||||
with patch('zerver.views.public_export.queue_json_publish') as mock_publish:
|
with patch('zerver.views.public_export.queue_json_publish') as mock_publish:
|
||||||
result = self.client_post('/json/export/realm')
|
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)
|
self.assert_json_success(result)
|
||||||
mock_publish.assert_called_once()
|
mock_publish.assert_called_once()
|
||||||
event = queue_data[1]
|
event = mock_publish.call_args_list[0][0][1]
|
||||||
self.assertEqual(worker, 'deferred_work')
|
self.assertEqual(mock_publish.call_args_list[0][0][0], 'deferred_work')
|
||||||
self.assertEqual(event['realm_id'], 1)
|
self.assertEqual(event['realm_id'], 1)
|
||||||
self.assertEqual(event['user_profile_id'], 5)
|
self.assertEqual(event['user_profile_id'], 5)
|
||||||
self.assertEqual(event['type'], 'realm_exported')
|
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:
|
with patch('zerver.views.public_export.queue_json_publish') as mock_publish:
|
||||||
result = self.client_post('/json/export/realm')
|
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)
|
self.assert_json_success(result)
|
||||||
mock_publish.assert_called_once()
|
mock_publish.assert_called_once()
|
||||||
event = queue_data[1]
|
event = mock_publish.call_args_list[0][0][1]
|
||||||
self.assertEqual(worker, 'deferred_work')
|
self.assertEqual(mock_publish.call_args_list[0][0][0], 'deferred_work')
|
||||||
self.assertEqual(event['realm_id'], 1)
|
self.assertEqual(event['realm_id'], 1)
|
||||||
self.assertEqual(event['user_profile_id'], 5)
|
self.assertEqual(event['user_profile_id'], 5)
|
||||||
self.assertEqual(event['type'], 'realm_exported')
|
self.assertEqual(event['type'], 'realm_exported')
|
||||||
|
|
Loading…
Reference in New Issue