Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
test_stripe: Fix invalid UserProfile creation.
Mateusz Manderadd5349096f3e
diff --git a/corporate/tests/test_stripe.py b/corporate/tests/test_stripe.pyindex 6036e494501..107a07d453e 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='[email protected]')- user2 = UserProfile.objects.create(realm=realm, email='[email protected]')+ user1 = UserProfile.objects.create(realm=realm, email='[email protected]',+ delivery_email='[email protected]')+ user2 = UserProfile.objects.create(realm=realm, email='[email protected]',+ delivery_email='[email protected]')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='[email protected]', role=UserProfile.ROLE_GUEST)+ UserProfile.objects.create(realm=realm, email='[email protected]', delivery_email='[email protected]',+ role=UserProfile.ROLE_GUEST)self.assertEqual(get_latest_seat_count(realm), initial_count)# Test 1 member and 5 guestsrealm = Realm.objects.create(string_id='second', name='second')- UserProfile.objects.create(realm=realm, email='[email protected]')+ UserProfile.objects.create(realm=realm, email='[email protected]',+ delivery_email='[email protected]')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 guestsUserProfile.objects.create(realm=realm, email='[email protected]',+ delivery_email='[email protected]',role=UserProfile.ROLE_GUEST)self.assertEqual(get_latest_seat_count(realm), 2)