mirror of
https://github.com/tgstation/tgstation-server.git
synced 2026-08-22 12:37:24 +01:00
Test updates
This commit is contained in:
@@ -87,8 +87,8 @@ namespace Tgstation.Server.Host.Controllers
|
||||
if (countOfExistingBotsInInstance >= Instance.ChatBotLimit.Value)
|
||||
return Conflict(new ErrorMessage(ErrorCode.ChatBotMax));
|
||||
|
||||
model.Enabled = model.Enabled ?? false;
|
||||
model.ReconnectionInterval = model.ReconnectionInterval ?? 1;
|
||||
model.Enabled ??= false;
|
||||
model.ReconnectionInterval ??= 1;
|
||||
|
||||
// try to update das db first
|
||||
var dbModel = new Models.ChatBot
|
||||
@@ -330,7 +330,7 @@ namespace Tgstation.Server.Host.Controllers
|
||||
return BadRequest(new ErrorMessage(ErrorCode.ChatBotMaxChannels));
|
||||
|
||||
if (forCreation)
|
||||
model.ChannelLimit = model.ChannelLimit ?? (ushort)defaultMaxChannels;
|
||||
model.ChannelLimit ??= (ushort)defaultMaxChannels;
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -198,6 +198,7 @@ namespace Tgstation.Server.Tests.Instance
|
||||
await ApiAssert.ThrowsException<ConflictException>(() => instanceClient.Update(instance, cancellationToken), ErrorCode.ChatBotMax);
|
||||
|
||||
discordBot.ChannelLimit = 20;
|
||||
discordBot.Channels = null;
|
||||
await chatClient.Update(discordBot, cancellationToken);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -167,11 +167,14 @@ namespace Tgstation.Server.Tests
|
||||
InstanceManagerRights = InstanceManagerRights.SetChatBotLimit
|
||||
};
|
||||
await usersClient.Update(update, cancellationToken);
|
||||
firstTest.ChatBotLimit = 77;
|
||||
var newThing = await instanceManagerClient.Update(firstTest, cancellationToken);
|
||||
Assert.AreEqual(77, newThing.ChatBotLimit);
|
||||
var update2 = new Api.Models.Instance
|
||||
{
|
||||
Id = firstTest.Id,
|
||||
ChatBotLimit = 77
|
||||
};
|
||||
var newThing = await instanceManagerClient.Update(update2, cancellationToken);
|
||||
|
||||
update.InstanceManagerRights |= InstanceManagerRights.Delete;
|
||||
update.InstanceManagerRights |= InstanceManagerRights.Delete | InstanceManagerRights.Create;
|
||||
await usersClient.Update(update, cancellationToken);
|
||||
|
||||
//but only if the attach file exists
|
||||
|
||||
Reference in New Issue
Block a user