def get_portal_url(self, redirect_url): if not self.subscription_id: return None if not self.customer_id: self.customer_id = get_customer_id_from_subscription_id( self.subscription_id) self.save() return get_portal_url(self.customer_id, redirect_url)
def test_get_portal_url(self, mock_cb): # Given access_url = 'https://test.url.com' mock_cb.PortalSession.create.return_value = MockChargeBeePortalSessionResponse( access_url) # When portal_url = get_portal_url('some-customer-id', 'https://redirect.url.com') # Then assert portal_url == access_url