Skip to content

Commit 29c1276

Browse files
test: add QueryFutureChannelBans test with TargetUserId filter
Test the new TargetUserId parameter for filtering future channel bans. Co-Authored-By: Claude Opus 4.5 <[email protected]>
1 parent 6a633d6 commit 29c1276

File tree

1 file changed

+71
-0
lines changed

1 file changed

+71
-0
lines changed

tests/UserClientTests.cs

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -631,5 +631,76 @@ public Task TestMarkDelivered_NoUserOrUserId_ThrowsArgumentExceptionAsync()
631631

632632
return markDeliveredCall.Should().ThrowAsync<ArgumentException>();
633633
}
634+
635+
[Test]
636+
public async Task TestQueryFutureChannelBansWithTargetUserIdAsync()
637+
{
638+
var creator = await UpsertNewUserAsync();
639+
var target1 = await UpsertNewUserAsync();
640+
var target2 = await UpsertNewUserAsync();
641+
642+
try
643+
{
644+
// Ban both targets from future channels created by creator
645+
await _userClient.BanAsync(new BanRequest
646+
{
647+
TargetUserId = target1.Id,
648+
UserId = creator.Id,
649+
BanFromFutureChannels = true,
650+
Reason = "test ban 1",
651+
});
652+
653+
await _userClient.BanAsync(new BanRequest
654+
{
655+
TargetUserId = target2.Id,
656+
UserId = creator.Id,
657+
BanFromFutureChannels = true,
658+
Reason = "test ban 2",
659+
});
660+
661+
// Query with TargetUserId filter - should only return the specific target
662+
var resp = await _userClient.QueryFutureChannelBansAsync(new QueryFutureChannelBansRequest
663+
{
664+
UserId = creator.Id,
665+
TargetUserId = target1.Id,
666+
});
667+
668+
resp.Bans.Should().HaveCount(1);
669+
resp.Bans[0].User.Id.Should().Be(target1.Id);
670+
671+
// Query for the other target
672+
resp = await _userClient.QueryFutureChannelBansAsync(new QueryFutureChannelBansRequest
673+
{
674+
UserId = creator.Id,
675+
TargetUserId = target2.Id,
676+
});
677+
678+
resp.Bans.Should().HaveCount(1);
679+
resp.Bans[0].User.Id.Should().Be(target2.Id);
680+
681+
// Query all future channel bans by creator (without target filter)
682+
resp = await _userClient.QueryFutureChannelBansAsync(new QueryFutureChannelBansRequest
683+
{
684+
UserId = creator.Id,
685+
});
686+
687+
resp.Bans.Should().HaveCountGreaterOrEqualTo(2);
688+
}
689+
finally
690+
{
691+
// Cleanup - unban both users
692+
await _userClient.UnbanAsync(new BanRequest
693+
{
694+
TargetUserId = target1.Id,
695+
UserId = creator.Id,
696+
});
697+
await _userClient.UnbanAsync(new BanRequest
698+
{
699+
TargetUserId = target2.Id,
700+
UserId = creator.Id,
701+
});
702+
await TryDeleteUsersAsync(creator.Id, target1.Id, target2.Id);
703+
}
704+
}
634705
}
635706
}

0 commit comments

Comments
 (0)