MdpIngestEndpointTests.cs 880 B

12345678910111213141516171819202122
  1. using System.Reflection;
  2. using Admin.NET.Plugin.AiDOP.DataPlatform.UnifiedIngress;
  3. using Microsoft.AspNetCore.Authorization;
  4. using Microsoft.AspNetCore.Mvc;
  5. using Xunit;
  6. namespace Admin.NET.Plugin.AiDOP.Tests.DataPlatform;
  7. public sealed class MdpIngestEndpointTests
  8. {
  9. [Fact]
  10. public void UnifiedIngestExposesDatasetPostUsingDedicatedAuthentication()
  11. {
  12. var controller = Assert.Single(typeof(MdpIngestDatasetController).Assembly.GetTypes().Where(type =>
  13. type.GetCustomAttribute<RouteAttribute>()?.Template == "api/v1/ingest"));
  14. var post = Assert.Single(controller.GetMethods().Where(method =>
  15. method.GetCustomAttribute<HttpPostAttribute>()?.Template == "{datasetKey}"));
  16. Assert.NotNull(post);
  17. Assert.Equal("MdpUnifiedIngress", controller.GetCustomAttribute<AuthorizeAttribute>()?.AuthenticationSchemes);
  18. }
  19. }