minor: Fix user/stream in test_subscriptions.

This commit is contained in:
Steve Howell 2020-10-13 13:44:31 +00:00 committed by Tim Abbott
parent 9df9934ed6
commit 188cc9bb3b
1 changed files with 12 additions and 12 deletions

View File

@ -206,24 +206,24 @@ class TestRealmAuditLog(ZulipTestCase):
def test_subscriptions(self) -> None:
now = timezone_now()
user = [self.example_user('hamlet')]
stream = [self.make_stream('test_stream')]
user = self.example_user('hamlet')
stream = self.make_stream('test_stream')
acting_user = self.example_user('iago')
bulk_add_subscriptions(user[0].realm, stream, user, acting_user=acting_user)
bulk_add_subscriptions(user.realm, [stream], [user], acting_user=acting_user)
subscription_creation_logs = RealmAuditLog.objects.filter(event_type=RealmAuditLog.SUBSCRIPTION_CREATED,
event_time__gte=now, acting_user=acting_user, modified_user=user[0],
modified_stream=stream[0])
event_time__gte=now, acting_user=acting_user, modified_user=user,
modified_stream=stream)
self.assertEqual(subscription_creation_logs.count(), 1)
self.assertEqual(subscription_creation_logs[0].modified_stream.id, stream[0].id)
self.assertEqual(subscription_creation_logs[0].modified_user, user[0])
self.assertEqual(subscription_creation_logs[0].modified_stream.id, stream.id)
self.assertEqual(subscription_creation_logs[0].modified_user, user)
bulk_remove_subscriptions(user, stream, get_client("website"), acting_user=acting_user)
bulk_remove_subscriptions([user], [stream], get_client("website"), acting_user=acting_user)
subscription_deactivation_logs = RealmAuditLog.objects.filter(event_type=RealmAuditLog.SUBSCRIPTION_DEACTIVATED,
event_time__gte=now, acting_user=acting_user, modified_user=user[0],
modified_stream=stream[0])
event_time__gte=now, acting_user=acting_user, modified_user=user,
modified_stream=stream)
self.assertEqual(subscription_deactivation_logs.count(), 1)
self.assertEqual(subscription_deactivation_logs[0].modified_stream.id, stream[0].id)
self.assertEqual(subscription_deactivation_logs[0].modified_user, user[0])
self.assertEqual(subscription_deactivation_logs[0].modified_stream.id, stream.id)
self.assertEqual(subscription_deactivation_logs[0].modified_user, user)
def test_realm_activation(self) -> None:
realm = get_realm('zulip')