up the blokcing tasks
Some checks failed
Docs CI / lint-and-preview (push) Has been cancelled
Notify Smoke Test / Notifier Service Tests (push) Has been cancelled
Notify Smoke Test / Notification Smoke Test (push) Has been cancelled
Notify Smoke Test / Notify Unit Tests (push) Has been cancelled
AOC Guard CI / aoc-guard (push) Has been cancelled
AOC Guard CI / aoc-verify (push) Has been cancelled
Export Center CI / export-ci (push) Has been cancelled
Manifest Integrity / Validate Schema Integrity (push) Has been cancelled
Manifest Integrity / Validate Contract Documents (push) Has been cancelled
Manifest Integrity / Validate Pack Fixtures (push) Has been cancelled
Manifest Integrity / Audit SHA256SUMS Files (push) Has been cancelled
Manifest Integrity / Verify Merkle Roots (push) Has been cancelled
Policy Lint & Smoke / policy-lint (push) Has been cancelled
Risk Bundle CI / risk-bundle-build (push) Has been cancelled
Scanner Analyzers / Discover Analyzers (push) Has been cancelled
Scanner Analyzers / Validate Test Fixtures (push) Has been cancelled
Risk Bundle CI / risk-bundle-offline-kit (push) Has been cancelled
Risk Bundle CI / publish-checksums (push) Has been cancelled
Scanner Analyzers / Build Analyzers (push) Has been cancelled
Scanner Analyzers / Test Language Analyzers (push) Has been cancelled
Scanner Analyzers / Verify Deterministic Output (push) Has been cancelled
devportal-offline / build-offline (push) Has been cancelled
Mirror Thin Bundle Sign & Verify / mirror-sign (push) Has been cancelled
Some checks failed
Docs CI / lint-and-preview (push) Has been cancelled
Notify Smoke Test / Notifier Service Tests (push) Has been cancelled
Notify Smoke Test / Notification Smoke Test (push) Has been cancelled
Notify Smoke Test / Notify Unit Tests (push) Has been cancelled
AOC Guard CI / aoc-guard (push) Has been cancelled
AOC Guard CI / aoc-verify (push) Has been cancelled
Export Center CI / export-ci (push) Has been cancelled
Manifest Integrity / Validate Schema Integrity (push) Has been cancelled
Manifest Integrity / Validate Contract Documents (push) Has been cancelled
Manifest Integrity / Validate Pack Fixtures (push) Has been cancelled
Manifest Integrity / Audit SHA256SUMS Files (push) Has been cancelled
Manifest Integrity / Verify Merkle Roots (push) Has been cancelled
Policy Lint & Smoke / policy-lint (push) Has been cancelled
Risk Bundle CI / risk-bundle-build (push) Has been cancelled
Scanner Analyzers / Discover Analyzers (push) Has been cancelled
Scanner Analyzers / Validate Test Fixtures (push) Has been cancelled
Risk Bundle CI / risk-bundle-offline-kit (push) Has been cancelled
Risk Bundle CI / publish-checksums (push) Has been cancelled
Scanner Analyzers / Build Analyzers (push) Has been cancelled
Scanner Analyzers / Test Language Analyzers (push) Has been cancelled
Scanner Analyzers / Verify Deterministic Output (push) Has been cancelled
devportal-offline / build-offline (push) Has been cancelled
Mirror Thin Bundle Sign & Verify / mirror-sign (push) Has been cancelled
This commit is contained in:
@@ -1,22 +1,24 @@
|
||||
extern alias webservice;
|
||||
using System.Net;
|
||||
using System.Net.Http.Json;
|
||||
using System.Text.Json;
|
||||
using Microsoft.AspNetCore.Mvc.Testing;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using StellaOps.Notifier.WebService.Contracts;
|
||||
using StellaOps.Notifier.Worker.Storage;
|
||||
using StellaOps.Notify.Models;
|
||||
using StellaOps.Notify.Storage.Mongo.Repositories;
|
||||
using WebProgram = webservice::Program;
|
||||
using Xunit;
|
||||
|
||||
namespace StellaOps.Notifier.Tests.Endpoints;
|
||||
|
||||
public sealed class NotifyApiEndpointsTests : IClassFixture<WebApplicationFactory<Program>>
|
||||
public sealed class NotifyApiEndpointsTests : IClassFixture<WebApplicationFactory<WebProgram>>
|
||||
{
|
||||
private readonly HttpClient _client;
|
||||
private readonly InMemoryRuleRepository _ruleRepository;
|
||||
private readonly InMemoryTemplateRepository _templateRepository;
|
||||
|
||||
public NotifyApiEndpointsTests(WebApplicationFactory<Program> factory)
|
||||
public NotifyApiEndpointsTests(WebApplicationFactory<WebProgram> factory)
|
||||
{
|
||||
_ruleRepository = new InMemoryRuleRepository();
|
||||
_templateRepository = new InMemoryTemplateRepository();
|
||||
@@ -270,11 +272,11 @@ public sealed class NotifyApiEndpointsTests : IClassFixture<WebApplicationFactor
|
||||
{
|
||||
private readonly Dictionary<string, NotifyRule> _rules = new();
|
||||
|
||||
public Task UpsertAsync(NotifyRule rule, CancellationToken cancellationToken = default)
|
||||
public Task<NotifyRule> UpsertAsync(NotifyRule rule, CancellationToken cancellationToken = default)
|
||||
{
|
||||
var key = $"{rule.TenantId}:{rule.RuleId}";
|
||||
_rules[key] = rule;
|
||||
return Task.CompletedTask;
|
||||
return Task.FromResult(rule);
|
||||
}
|
||||
|
||||
public Task<NotifyRule?> GetAsync(string tenantId, string ruleId, CancellationToken cancellationToken = default)
|
||||
@@ -289,11 +291,11 @@ public sealed class NotifyApiEndpointsTests : IClassFixture<WebApplicationFactor
|
||||
return Task.FromResult<IReadOnlyList<NotifyRule>>(result);
|
||||
}
|
||||
|
||||
public Task DeleteAsync(string tenantId, string ruleId, CancellationToken cancellationToken = default)
|
||||
public Task<bool> DeleteAsync(string tenantId, string ruleId, CancellationToken cancellationToken = default)
|
||||
{
|
||||
var key = $"{tenantId}:{ruleId}";
|
||||
_rules.Remove(key);
|
||||
return Task.CompletedTask;
|
||||
var removed = _rules.Remove(key);
|
||||
return Task.FromResult(removed);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -301,11 +303,11 @@ public sealed class NotifyApiEndpointsTests : IClassFixture<WebApplicationFactor
|
||||
{
|
||||
private readonly Dictionary<string, NotifyTemplate> _templates = new();
|
||||
|
||||
public Task UpsertAsync(NotifyTemplate template, CancellationToken cancellationToken = default)
|
||||
public Task<NotifyTemplate> UpsertAsync(NotifyTemplate template, CancellationToken cancellationToken = default)
|
||||
{
|
||||
var key = $"{template.TenantId}:{template.TemplateId}";
|
||||
_templates[key] = template;
|
||||
return Task.CompletedTask;
|
||||
return Task.FromResult(template);
|
||||
}
|
||||
|
||||
public Task<NotifyTemplate?> GetAsync(string tenantId, string templateId, CancellationToken cancellationToken = default)
|
||||
@@ -320,11 +322,11 @@ public sealed class NotifyApiEndpointsTests : IClassFixture<WebApplicationFactor
|
||||
return Task.FromResult<IReadOnlyList<NotifyTemplate>>(result);
|
||||
}
|
||||
|
||||
public Task DeleteAsync(string tenantId, string templateId, CancellationToken cancellationToken = default)
|
||||
public Task<bool> DeleteAsync(string tenantId, string templateId, CancellationToken cancellationToken = default)
|
||||
{
|
||||
var key = $"{tenantId}:{templateId}";
|
||||
_templates.Remove(key);
|
||||
return Task.CompletedTask;
|
||||
var removed = _templates.Remove(key);
|
||||
return Task.FromResult(removed);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user