stripe: Don't check value of realm_id directly in tests.

Value of realm_id varies from one development environment
to another from time to time. So we will just check whether
realm_id is a number instead.
This commit is contained in:
Vishnu KS 2019-08-19 14:11:19 +05:30 committed by Rishi Gupta
parent 96cdfd676b
commit 6c8d837401
1 changed files with 7 additions and 2 deletions

View File

@ -343,8 +343,13 @@ class StripeTest(StripeTestCase):
self.assertEqual(stripe_customer.description, "zulip (Zulip Dev)") self.assertEqual(stripe_customer.description, "zulip (Zulip Dev)")
self.assertEqual(stripe_customer.discount, None) self.assertEqual(stripe_customer.discount, None)
self.assertEqual(stripe_customer.email, user.email) self.assertEqual(stripe_customer.email, user.email)
self.assertEqual(dict(stripe_customer.metadata), metadata_dict = dict(stripe_customer.metadata)
{'realm_id': str(user.realm.id), 'realm_str': 'zulip'}) self.assertEqual(metadata_dict['realm_str'], 'zulip')
try:
int(metadata_dict['realm_id'])
except ValueError: # nocoverage
raise AssertionError("realm_id is not a number")
# Check Charges in Stripe # Check Charges in Stripe
stripe_charges = [charge for charge in stripe.Charge.list(customer=stripe_customer.id)] stripe_charges = [charge for charge in stripe.Charge.list(customer=stripe_customer.id)]
self.assertEqual(len(stripe_charges), 1) self.assertEqual(len(stripe_charges), 1)