Kick, ban and set groups from the Android client sheet, with a ban list
The client sheet offers kicking from the channel or the server (asking to confirm, with an optional reason), banning with a reason and duration, and the client's server groups and channel group. The server sheet opens the ban list: search, own bans only, and adding, editing and deleting bans, with the reason presets the desktop keeps. Kick and ban powers, like move power, never come with the needed permissions, so core now asks for all four in one piped permget. The ban permission checks, a ban's summary, the duration units, the group choices for a client and the kick reason limit move into core, and Swing uses them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
package com.ts3client.net.ban;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
class BanUnitTest {
|
||||
|
||||
@Test
|
||||
void lengthsShowInTheLargestUnitThatDividesThem() {
|
||||
assertEquals(BanUnit.DAYS, BanUnit.largestFor(2 * 86400));
|
||||
assertEquals(BanUnit.HOURS, BanUnit.largestFor(90 * 60 * 2));
|
||||
assertEquals(BanUnit.MINUTES, BanUnit.largestFor(120));
|
||||
assertEquals(BanUnit.SECONDS, BanUnit.largestFor(61));
|
||||
assertEquals(2, BanUnit.DAYS.amountOf(2 * 86400));
|
||||
}
|
||||
|
||||
@Test
|
||||
void noLengthIsPermanent() {
|
||||
assertEquals(BanUnit.PERMANENT, BanUnit.largestFor(0));
|
||||
assertEquals(BanUnit.PERMANENT, BanUnit.largestFor(-1));
|
||||
assertEquals(0, BanUnit.PERMANENT.toSeconds(30));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user