fix hosting tests

This commit is contained in:
bruks 2026-10-04 18:36:54 +01:00
commit 4bcb3f2e04
5 changed files with 159 additions and 260 deletions

View file

@ -15,6 +15,7 @@ from datacenterlight.models import StripePlan
from membership.models import StripeCustomer
from utils.stripe_utils import StripeUtils
from .tasks import save_ssh_key
from factories import CustomUserFactory
class BaseTestCase(TestCase):
@ -304,3 +305,13 @@ class SaveSSHKeyTestCase(TestCase):
break
self.assertIsNotNone(save_ssh_key, "save_ssh_key_result is None")
self.assertTrue(save_ssh_key_result, "save_ssh_key_result is False")
def create_customer_client(customer=None):
"""Create a logged-in test client without invoking the login backend."""
customer = customer or CustomUserFactory.create()
client = Client()
client.force_login(customer)
return customer, client