Add services to limit_osb_services on activation

ref #38
This commit is contained in:
Tobias Kunze 2025-10-07 13:54:38 +02:00
parent df3e3d5f0c
commit 3730d95a6e
2 changed files with 32 additions and 37 deletions

View file

@ -87,6 +87,7 @@ def test_successful_onboarding_new_organization(
assert org.odoo_sale_order_id == 789
assert org.odoo_sale_order_name == "SO001"
assert org.limit_osb_services.all().count() == 1
assert len(mail.outbox) == 2
invitation_email = mail.outbox[0]
@ -107,11 +108,12 @@ def test_duplicate_organization_returns_existing(
exoscale_origin,
instance_id,
):
Organization.objects.create(
org = Organization.objects.create(
name="Existing Org",
osb_guid="test-org-guid-123",
origin=exoscale_origin,
)
org.limit_osb_services.add(test_service)
valid_osb_payload["service_id"] = test_service.osb_service_id
valid_osb_payload["plan_id"] = test_service_offering.osb_plan_id
@ -126,7 +128,7 @@ def test_duplicate_organization_returns_existing(
response_data = json.loads(response.content)
assert response_data["message"] == "Service already enabled"
assert Organization.objects.filter(osb_guid="test-org-guid-123").count() == 1
assert len(mail.outbox) == 1 # Only one email was sent
assert len(mail.outbox) == 0 # No email necessary
@pytest.mark.django_db