Skip to content

Commit 4552491

Browse files
psincraianclaude
andcommitted
fix: correct test assertions for member_model_enabled behavior
The test was expecting seat.customer_id to equal the seat member's customer, but with member_model_enabled=True, seat.customer_id should equal the billing customer (subscription owner). Updated assertions to match the actual implementation behavior. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
1 parent 5b27318 commit 4552491

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

server/tests/customer_seat/test_service.py

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -641,7 +641,14 @@ async def test_assign_seat_with_member_model_enabled(
641641
session: AsyncSession,
642642
save_fixture: SaveFixture,
643643
) -> None:
644-
"""Test that assign_seat creates a member when member_model_enabled is true."""
644+
"""Test that assign_seat creates a member when member_model_enabled is true.
645+
646+
When member_model_enabled=True:
647+
- seat.customer_id = billing customer (subscription owner)
648+
- seat.member_id = member created under billing customer
649+
- seat.email = email of the seat member
650+
- No separate Customer is created for the seat member
651+
"""
645652
organization = await create_organization(
646653
save_fixture,
647654
feature_settings={
@@ -667,25 +674,22 @@ async def test_assign_seat_with_member_model_enabled(
667674
subscription = await create_subscription_with_seats(
668675
save_fixture, product=product, customer=billing_customer, seats=5
669676
)
670-
# Seat customer (to be assigned a seat)
671-
seat_customer = await create_customer(
672-
save_fixture,
673-
organization=organization,
674-
675-
)
676677

677678
seat = await seat_service.assign_seat(
678679
session, subscription, email="[email protected]"
679680
)
680681

681-
assert seat.customer_id == seat_customer.id
682+
# customer_id should be the billing customer (purchaser), not a new customer
683+
assert seat.customer_id == billing_customer.id
682684
assert seat.member_id is not None
685+
assert seat.email == "[email protected]"
683686

684687
# Verify member was created with correct properties
685688
await session.refresh(seat, ["member"])
686689
assert seat.member is not None
687-
assert seat.member.customer_id == seat_customer.id
688-
assert seat.member.email == seat_customer.email
690+
# Member is created under the billing customer
691+
assert seat.member.customer_id == billing_customer.id
692+
assert seat.member.email == "[email protected]"
689693
assert seat.member.organization_id == organization.id
690694

691695
@pytest.mark.asyncio

0 commit comments

Comments
 (0)