LoadPLugins tests
This commit is contained in:
3
.github/workflows/build.yml
vendored
3
.github/workflows/build.yml
vendored
@@ -60,7 +60,8 @@ jobs:
|
||||
--configuration Release \
|
||||
--no-restore \
|
||||
--logger "trx;LogFileName=test-results.trx" \
|
||||
--collect:"XPlat Code Coverage"
|
||||
--collect:"XPlat Code Coverage" \
|
||||
--filter "Category!=LocalOnly"
|
||||
|
||||
- name: Publish Test Results
|
||||
uses: actions/upload-artifact@v4
|
||||
|
||||
@@ -132,7 +132,5 @@ public class PluginManager
|
||||
{
|
||||
return _exporters.FirstOrDefault(e => e.CanExport(exporterType));
|
||||
}
|
||||
|
||||
public IEnumerable<IDataExporter> GetAllExporters() => _exporters.AsReadOnly();
|
||||
public IEnumerable<IPlugin> GetAllPlugins() => _plugins.AsReadOnly();
|
||||
public int GetPluginsCount() => _processorTypes.Count + _importerTypes.Count + _exporters.Count;
|
||||
}
|
||||
@@ -18,7 +18,7 @@ public class ApiConnectionTests : IClassFixture<WebApplicationFactory<Program>>
|
||||
{
|
||||
var client = _factory.CreateClient();
|
||||
|
||||
var response = await client.GetAsync("/api/Ping/Ping");
|
||||
var response = await client.GetAsync("/api/Tests/Ping");
|
||||
var content = await response.Content.ReadAsStringAsync();
|
||||
var statusCode = (int)response.StatusCode;
|
||||
|
||||
@@ -27,6 +27,7 @@ public class ApiConnectionTests : IClassFixture<WebApplicationFactory<Program>>
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", "LocalOnly")]
|
||||
public async Task DatabaseConnectionTest()
|
||||
{
|
||||
var client = _factory.CreateClient();
|
||||
@@ -39,4 +40,17 @@ public class ApiConnectionTests : IClassFixture<WebApplicationFactory<Program>>
|
||||
var layers = JsonSerializer.Deserialize<dynamic>(content);
|
||||
Assert.NotNull(layers);
|
||||
}
|
||||
[Fact]
|
||||
public async Task LoadPLuginsTest()
|
||||
{
|
||||
var client = _factory.CreateClient();
|
||||
|
||||
var response = await client.GetAsync("/api/Tests/Plugins");
|
||||
var content = await response.Content.ReadAsStringAsync();
|
||||
var statusCode = (int)response.StatusCode;
|
||||
|
||||
Assert.Equal(200, statusCode);
|
||||
var pluginsCount = JsonSerializer.Deserialize<int>(content);
|
||||
Assert.True(pluginsCount > 0, "Expected plugins count to be greater than 0");
|
||||
}
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
using System.Data;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Data.SqlClient;
|
||||
using DiunaBI.Core.Models;
|
||||
|
||||
namespace DiunaBI.Core.Controllers;
|
||||
|
||||
[ApiController]
|
||||
[Route("api/[controller]")]
|
||||
public class AdminController : Controller
|
||||
{
|
||||
|
||||
private readonly IConfiguration _configuration;
|
||||
|
||||
public AdminController(
|
||||
IConfiguration configuration)
|
||||
{
|
||||
_configuration = configuration;
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[Route("Version")]
|
||||
public IActionResult GetVersion()
|
||||
{
|
||||
return Ok(new { version = _configuration["app-version"] });
|
||||
}
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace DiunaBI.WebAPI.Controllers;
|
||||
|
||||
[ApiController]
|
||||
[Route("api/[controller]")]
|
||||
[Authorize]
|
||||
public class PingController : Controller
|
||||
{
|
||||
private readonly IConfiguration _configuration;
|
||||
public PingController(
|
||||
IConfiguration configuration)
|
||||
{
|
||||
_configuration = configuration;
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[Route("Ping")]
|
||||
[AllowAnonymous]
|
||||
public IActionResult Ping()
|
||||
{
|
||||
return Ok("Pong");
|
||||
}
|
||||
}
|
||||
34
src/Backend/DiunaBI.WebAPI/Controllers/TestsController.cs
Normal file
34
src/Backend/DiunaBI.WebAPI/Controllers/TestsController.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
using DiunaBI.Core.Services;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace DiunaBI.WebAPI.Controllers;
|
||||
|
||||
[ApiController]
|
||||
[Route("api/[controller]")]
|
||||
[Authorize]
|
||||
public class TestsController : Controller
|
||||
{
|
||||
private readonly PluginManager _pluginManager;
|
||||
public TestsController(
|
||||
PluginManager pluginManager)
|
||||
{
|
||||
_pluginManager = pluginManager;
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[Route("Ping")]
|
||||
[AllowAnonymous]
|
||||
public IActionResult Ping()
|
||||
{
|
||||
return Ok("Pong");
|
||||
}
|
||||
[HttpGet]
|
||||
[Route("Plugins")]
|
||||
[AllowAnonymous]
|
||||
public IActionResult GetPlugins()
|
||||
{
|
||||
var plugins = _pluginManager.GetPluginsCount();
|
||||
return Ok(plugins);
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,3 @@
|
||||
###
|
||||
GET http://localhost:5400/api/Layers/RunQueueJobs/10763478CB738D4ecb2h76g803478CB738D4e
|
||||
GET http://localhost:5400/api/Tests/Plugins
|
||||
|
||||
|
||||
Reference in New Issue
Block a user