mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2024-11-19 09:54:30 +01:00
Adding list notification test
This commit is contained in:
parent
2c44c25b25
commit
261931c8ef
@ -1195,6 +1195,35 @@ namespace BTCPayServer.Tests
|
||||
}
|
||||
}
|
||||
|
||||
[Fact(Timeout = TestTimeout)]
|
||||
[Trait("Integration", "Integration")]
|
||||
public async Task CanListNotifications()
|
||||
{
|
||||
using (var tester = ServerTester.Create())
|
||||
{
|
||||
await tester.StartAsync();
|
||||
var acc = tester.NewAccount();
|
||||
acc.GrantAccess(true);
|
||||
acc.RegisterDerivationScheme("BTC");
|
||||
|
||||
const string newVersion = "1.0.4.4";
|
||||
var ctrl = acc.GetController<NotificationsController>();
|
||||
var resp = await ctrl.Generate(newVersion);
|
||||
|
||||
var vm = Assert.IsType<Models.NotificationViewModels.IndexViewModel>(
|
||||
Assert.IsType<ViewResult>(ctrl.Index().Result).Model);
|
||||
|
||||
Assert.True(vm.Skip == 0);
|
||||
Assert.True(vm.Count == 50);
|
||||
Assert.True(vm.Total == 1);
|
||||
Assert.True(vm.Items.Count == 1);
|
||||
|
||||
var fn = vm.Items.First();
|
||||
Assert.Equal($"New version {newVersion} released!", fn.Body);
|
||||
Assert.Equal($"https://github.com/btcpayserver/btcpayserver/releases/tag/v{newVersion}", fn.ActionLink);
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Integration", "Integration")]
|
||||
public async Task CanGetRates()
|
||||
|
@ -55,11 +55,11 @@ namespace BTCPayServer.Controllers
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public async Task<IActionResult> Generate()
|
||||
public async Task<IActionResult> Generate(string version)
|
||||
{
|
||||
await _notificationSender.NoticeNewVersionAsync("1.0.4.4");
|
||||
await _notificationSender.NoticeNewVersionAsync(version);
|
||||
// waiting for event handler to catch up
|
||||
await Task.Delay(1000);
|
||||
await Task.Delay(500);
|
||||
return RedirectToAction(nameof(Index));
|
||||
}
|
||||
|
||||
|
@ -32,7 +32,7 @@
|
||||
<button type="submit" class="dropdown-item" name="command" value="delete"><i class="fa fa-trash-o"></i> Delete</button>
|
||||
</div>
|
||||
</span>
|
||||
<a class="btn btn-primary" role="button" asp-action="Generate" id="Generate"><span class="fa fa-plus"></span> Generate Test Notification</a>
|
||||
<a class="btn btn-primary" role="button" asp-action="Generate" asp-route-version="1.0.4.4" id="Generate"><span class="fa fa-plus"></span> Generate Test Notification</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
|
Loading…
Reference in New Issue
Block a user