mirror of
https://github.com/Sheldan/abstracto.git
synced 2026-04-13 19:41:38 +00:00
added message to user initiated context
fixed templates for ban and kick logging refactored kicking service fixed guild not found exception template added command validator to be used for unit testing commands added default values for command configuration changed some interfaces to message channel instead of text channel added separate executor service for un-mutes, which is shared updated spring boot version to 2.3.1 removed database connection string from properties added logback configuration changed some future logic in purge refactored error message for un mute, when there is no active mute refactored listener interface and removed usage of context utils added tests for moderation services
This commit is contained in:
@@ -7,6 +7,7 @@ import dev.sheldan.abstracto.core.command.execution.CommandResult;
|
||||
import dev.sheldan.abstracto.core.models.database.ARole;
|
||||
import dev.sheldan.abstracto.experience.service.management.DisabledExpRoleManagementService;
|
||||
import dev.sheldan.abstracto.test.MockUtils;
|
||||
import dev.sheldan.abstracto.test.command.CommandConfigValidator;
|
||||
import dev.sheldan.abstracto.test.command.CommandTestUtilities;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
@@ -55,4 +56,9 @@ public class DisableExpForRoleTest {
|
||||
verify(disabledExpRoleManagementService, times(wantedNumberOfInvocations)).setRoleToBeDisabledForExp(disabledRole);
|
||||
CommandTestUtilities.checkSuccessfulCompletion(result);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void validateCommand() {
|
||||
CommandConfigValidator.validateCommandConfiguration(testUnit.getConfiguration());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import dev.sheldan.abstracto.core.models.database.AUserInAServer;
|
||||
import dev.sheldan.abstracto.core.service.management.UserInServerManagementService;
|
||||
import dev.sheldan.abstracto.experience.service.AUserExperienceService;
|
||||
import dev.sheldan.abstracto.test.MockUtils;
|
||||
import dev.sheldan.abstracto.test.command.CommandConfigValidator;
|
||||
import dev.sheldan.abstracto.test.command.CommandTestUtilities;
|
||||
import net.dv8tion.jda.api.entities.Member;
|
||||
import org.junit.Test;
|
||||
@@ -55,4 +56,8 @@ public class DisableExpGainTest {
|
||||
CommandTestUtilities.checkSuccessfulCompletion(result);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void validateCommand() {
|
||||
CommandConfigValidator.validateCommandConfiguration(testUnit.getConfiguration());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import dev.sheldan.abstracto.core.command.execution.CommandResult;
|
||||
import dev.sheldan.abstracto.core.models.database.ARole;
|
||||
import dev.sheldan.abstracto.experience.service.management.DisabledExpRoleManagementService;
|
||||
import dev.sheldan.abstracto.test.MockUtils;
|
||||
import dev.sheldan.abstracto.test.command.CommandConfigValidator;
|
||||
import dev.sheldan.abstracto.test.command.CommandTestUtilities;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
@@ -55,4 +56,9 @@ public class EnableExpForRoleTest {
|
||||
verify(disabledExpRoleManagementService, times(wantedNumberOfInvocations)).removeRoleToBeDisabledForExp(disabledRole);
|
||||
CommandTestUtilities.checkSuccessfulCompletion(result);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void validateCommand() {
|
||||
CommandConfigValidator.validateCommandConfiguration(testUnit.getConfiguration());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import dev.sheldan.abstracto.core.models.database.AUserInAServer;
|
||||
import dev.sheldan.abstracto.core.service.management.UserInServerManagementService;
|
||||
import dev.sheldan.abstracto.experience.service.AUserExperienceService;
|
||||
import dev.sheldan.abstracto.test.MockUtils;
|
||||
import dev.sheldan.abstracto.test.command.CommandConfigValidator;
|
||||
import dev.sheldan.abstracto.test.command.CommandTestUtilities;
|
||||
import net.dv8tion.jda.api.entities.Member;
|
||||
import org.junit.Test;
|
||||
@@ -55,4 +56,9 @@ public class EnableExpGainTest {
|
||||
CommandTestUtilities.checkSuccessfulCompletion(result);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void validateCommand() {
|
||||
CommandConfigValidator.validateCommandConfiguration(testUnit.getConfiguration());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import dev.sheldan.abstracto.core.command.exception.InsufficientParameters;
|
||||
import dev.sheldan.abstracto.core.command.execution.CommandContext;
|
||||
import dev.sheldan.abstracto.core.command.execution.CommandResult;
|
||||
import dev.sheldan.abstracto.core.service.ConfigService;
|
||||
import dev.sheldan.abstracto.test.command.CommandConfigValidator;
|
||||
import dev.sheldan.abstracto.test.command.CommandTestUtilities;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
@@ -42,6 +43,10 @@ public class ExpScaleTest {
|
||||
CommandResult result = testUnit.execute(context);
|
||||
CommandTestUtilities.checkSuccessfulCompletion(result);
|
||||
verify(configService, times(1)).setDoubleValue(ExpScale.EXP_MULTIPLIER_KEY, context.getGuild().getIdLong(), newScale);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void validateCommand() {
|
||||
CommandConfigValidator.validateCommandConfiguration(testUnit.getConfiguration());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ import dev.sheldan.abstracto.experience.models.templates.LeaderBoardModel;
|
||||
import dev.sheldan.abstracto.experience.service.AUserExperienceService;
|
||||
import dev.sheldan.abstracto.templating.model.MessageToSend;
|
||||
import dev.sheldan.abstracto.templating.service.TemplateService;
|
||||
import dev.sheldan.abstracto.test.command.CommandConfigValidator;
|
||||
import dev.sheldan.abstracto.test.command.CommandTestUtilities;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
@@ -71,4 +72,9 @@ public class LeaderBoardCommandTest {
|
||||
verify(channelService, times(1)).sendMessageToSendToChannel(messageToSend, context.getChannel());
|
||||
CommandTestUtilities.checkSuccessfulCompletion(result);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void validateCommand() {
|
||||
CommandConfigValidator.validateCommandConfiguration(testUnit.getConfiguration());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ import dev.sheldan.abstracto.experience.models.database.ADisabledExpRole;
|
||||
import dev.sheldan.abstracto.experience.models.templates.DisabledExperienceRolesModel;
|
||||
import dev.sheldan.abstracto.experience.service.management.DisabledExpRoleManagementService;
|
||||
import dev.sheldan.abstracto.test.MockUtils;
|
||||
import dev.sheldan.abstracto.test.command.CommandConfigValidator;
|
||||
import dev.sheldan.abstracto.test.command.CommandTestUtilities;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
@@ -62,4 +63,9 @@ public class ListDisabledExperienceRolesTest {
|
||||
verify(channelService, times(1)).sendEmbedTemplateInChannel(eq("list_disabled_experience_roles"),
|
||||
any(DisabledExperienceRolesModel.class), eq(context.getChannel()));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void validateCommand() {
|
||||
CommandConfigValidator.validateCommandConfiguration(testUnit.getConfiguration());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ import dev.sheldan.abstracto.experience.service.AUserExperienceService;
|
||||
import dev.sheldan.abstracto.experience.service.ExperienceLevelService;
|
||||
import dev.sheldan.abstracto.templating.model.MessageToSend;
|
||||
import dev.sheldan.abstracto.templating.service.TemplateService;
|
||||
import dev.sheldan.abstracto.test.command.CommandConfigValidator;
|
||||
import dev.sheldan.abstracto.test.command.CommandTestUtilities;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
@@ -62,4 +63,9 @@ public class RankTest {
|
||||
verify(channelService, Mockito.times(1)).sendMessageToSendToChannel(messageToSend, context.getChannel());
|
||||
CommandTestUtilities.checkSuccessfulCompletion(result);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void validateCommand() {
|
||||
CommandConfigValidator.validateCommandConfiguration(testUnit.getConfiguration());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ import dev.sheldan.abstracto.core.models.database.ARole;
|
||||
import dev.sheldan.abstracto.core.service.RoleService;
|
||||
import dev.sheldan.abstracto.experience.service.ExperienceRoleService;
|
||||
import dev.sheldan.abstracto.test.MockUtils;
|
||||
import dev.sheldan.abstracto.test.command.CommandConfigValidator;
|
||||
import dev.sheldan.abstracto.test.command.CommandTestUtilities;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
@@ -75,4 +76,9 @@ public class SetExpRoleTest {
|
||||
when(roleService.isRoleInServer(changedRole)).thenReturn(false);
|
||||
testUnit.execute(context);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void validateCommand() {
|
||||
CommandConfigValidator.validateCommandConfiguration(testUnit.getConfiguration());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import dev.sheldan.abstracto.core.command.execution.CommandResult;
|
||||
import dev.sheldan.abstracto.core.models.database.AChannel;
|
||||
import dev.sheldan.abstracto.core.models.database.AServer;
|
||||
import dev.sheldan.abstracto.experience.service.AUserExperienceService;
|
||||
import dev.sheldan.abstracto.test.command.CommandConfigValidator;
|
||||
import dev.sheldan.abstracto.test.command.CommandTestUtilities;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
@@ -32,4 +33,9 @@ public class SyncRolesTest {
|
||||
verify(userExperienceService, times(1)).syncUserRolesWithFeedback(server, channel);
|
||||
CommandTestUtilities.checkSuccessfulCompletion(result);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void validateCommand() {
|
||||
CommandConfigValidator.validateCommandConfiguration(testUnit.getConfiguration());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import dev.sheldan.abstracto.core.command.execution.CommandResult;
|
||||
import dev.sheldan.abstracto.core.models.database.ARole;
|
||||
import dev.sheldan.abstracto.experience.service.ExperienceRoleService;
|
||||
import dev.sheldan.abstracto.test.MockUtils;
|
||||
import dev.sheldan.abstracto.test.command.CommandConfigValidator;
|
||||
import dev.sheldan.abstracto.test.command.CommandTestUtilities;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
@@ -47,4 +48,9 @@ public class UnSetExpRoleTest {
|
||||
CommandTestUtilities.checkSuccessfulCompletion(result);
|
||||
verify(experienceRoleService, times(1)).unsetRole(changedRole, context.getUserInitiatedContext().getChannel());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void validateCommand() {
|
||||
CommandConfigValidator.validateCommandConfiguration(testUnit.getConfiguration());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user