1
0

AdminTest.cs 1.1 KB

123456789101112131415161718192021222324252627282930313233
  1. using System.Collections.Generic;
  2. using System.Reflection;
  3. using Content.Server.Administration.Managers;
  4. using Robust.Shared.Toolshed;
  5. namespace Content.IntegrationTests.Tests.Toolshed;
  6. [TestFixture]
  7. public sealed class AdminTest : ToolshedTest
  8. {
  9. [Test]
  10. public async Task AllCommandsHavePermissions()
  11. {
  12. var toolMan = Server.ResolveDependency<ToolshedManager>();
  13. var admin = Server.ResolveDependency<IAdminManager>();
  14. var ignored = new HashSet<Assembly>()
  15. {typeof(LocTest).Assembly, typeof(Robust.UnitTesting.Shared.Toolshed.LocTest).Assembly};
  16. await Server.WaitAssertion(() =>
  17. {
  18. Assert.Multiple(() =>
  19. {
  20. foreach (var cmd in toolMan.DefaultEnvironment.AllCommands())
  21. {
  22. if (ignored.Contains(cmd.Cmd.GetType().Assembly))
  23. continue;
  24. Assert.That(admin.TryGetCommandFlags(cmd, out _), $"Command does not have admin permissions set up: {cmd.FullName()}");
  25. }
  26. });
  27. });
  28. }
  29. }