From dd5349096f3e96c40a6dd41668abf6e359b17b43 Mon Sep 17 00:00:00 2001 From: Mateusz Mandera Date: Wed, 15 Jul 2020 19:28:13 +0200 Subject: [PATCH] test_stripe: Fix invalid UserProfile creation. --- corporate/tests/test_stripe.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/corporate/tests/test_stripe.py b/corporate/tests/test_stripe.py index 6036e49450..107a07d453 100644 --- a/corporate/tests/test_stripe.py +++ b/corporate/tests/test_stripe.py @@ -1155,8 +1155,10 @@ class StripeTest(StripeTestCase): def test_get_latest_seat_count(self) -> None: realm = get_realm("zulip") initial_count = get_latest_seat_count(realm) - user1 = UserProfile.objects.create(realm=realm, email='user1@zulip.com') - user2 = UserProfile.objects.create(realm=realm, email='user2@zulip.com') + user1 = UserProfile.objects.create(realm=realm, email='user1@zulip.com', + delivery_email='user1@zulip.com') + user2 = UserProfile.objects.create(realm=realm, email='user2@zulip.com', + delivery_email='user2@zulip.com') self.assertEqual(get_latest_seat_count(realm), initial_count + 2) # Test that bots aren't counted @@ -1170,17 +1172,21 @@ class StripeTest(StripeTestCase): # Test guests # Adding a guest to a realm with a lot of members shouldn't change anything - UserProfile.objects.create(realm=realm, email='user3@zulip.com', role=UserProfile.ROLE_GUEST) + UserProfile.objects.create(realm=realm, email='user3@zulip.com', delivery_email='user3@zulip.com', + role=UserProfile.ROLE_GUEST) self.assertEqual(get_latest_seat_count(realm), initial_count) # Test 1 member and 5 guests realm = Realm.objects.create(string_id='second', name='second') - UserProfile.objects.create(realm=realm, email='member@second.com') + UserProfile.objects.create(realm=realm, email='member@second.com', + delivery_email='member@second.com') for i in range(5): UserProfile.objects.create(realm=realm, email=f'guest{i}@second.com', + delivery_email=f'guest{i}@second.com', role=UserProfile.ROLE_GUEST) self.assertEqual(get_latest_seat_count(realm), 1) # Test 1 member and 6 guests UserProfile.objects.create(realm=realm, email='guest5@second.com', + delivery_email='guest5@second.com', role=UserProfile.ROLE_GUEST) self.assertEqual(get_latest_seat_count(realm), 2)