From 6c8d8374017a6f52ddce074cf945da4016a7c9d1 Mon Sep 17 00:00:00 2001 From: Vishnu KS Date: Mon, 19 Aug 2019 14:11:19 +0530 Subject: [PATCH] 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. --- corporate/tests/test_stripe.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/corporate/tests/test_stripe.py b/corporate/tests/test_stripe.py index 13a569bc21..f1635e6f38 100644 --- a/corporate/tests/test_stripe.py +++ b/corporate/tests/test_stripe.py @@ -343,8 +343,13 @@ class StripeTest(StripeTestCase): self.assertEqual(stripe_customer.description, "zulip (Zulip Dev)") self.assertEqual(stripe_customer.discount, None) self.assertEqual(stripe_customer.email, user.email) - self.assertEqual(dict(stripe_customer.metadata), - {'realm_id': str(user.realm.id), 'realm_str': 'zulip'}) + metadata_dict = dict(stripe_customer.metadata) + 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 stripe_charges = [charge for charge in stripe.Charge.list(customer=stripe_customer.id)] self.assertEqual(len(stripe_charges), 1)