zulip/corporate/tests
Mateusz Mandera 834dbd552b remote_billing: Make handle_customer_migration_... more robust.
The logic in the case where there's only one realm and the function
tries to migrate the server's plan to it, had two main unhandled edge
cases that would throw exceptions:
1.
```
        remote_realm = RemoteRealm.objects.get(
            uuid=realm_uuids[0], plan_type=RemoteRealm.PLAN_TYPE_SELF_MANAGED
        )
```

This could throw an exception if the RemoteRealm exists, but has an
active e.g. Legacy plan. Then there'd be no object matching the
plan_type in the query, raising RemoteRealm.DoesNotExist.

2. If the RemoteRealm had e.g. a Legacy plan in the past, that's now
   expired, then it'd have a Customer object. Meaning that the attempt
   to move the server's customer to the realm:
   `server_plan.customer = remote_realm_customer`
   would trigger an IntegrityError since a RemoteRealm can't have two
   Customer objects.

In simple cases the situation in (2) can still be easily migrated, by
moving the plan from the server's customer to the realm's customer.
2024-02-20 16:02:03 -08:00
..
stripe_fixtures stripe: Add billing portal for customer name and address. 2024-02-13 14:18:38 -08:00
__init__.py
test_activity_views.py remote-activity: Add column for remote server or realm creation date. 2024-02-15 10:29:12 -08:00
test_remote_billing.py remote_billing: Make handle_customer_migration_... more robust. 2024-02-20 16:02:03 -08:00
test_remote_counts.py python: Consistently use from…import for datetime. 2023-12-05 12:01:18 -08:00
test_stripe.py zilencer: Implement do_reactivate_remote_server utility function. 2024-02-19 20:26:47 -08:00
test_support_views.py support: Add CSS grid for confirmation objects in query results. 2024-02-20 15:46:55 -08:00