mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2025-12-17 22:14:26 +01:00
Adding list notification test
This commit is contained in:
@@ -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]
|
[Fact]
|
||||||
[Trait("Integration", "Integration")]
|
[Trait("Integration", "Integration")]
|
||||||
public async Task CanGetRates()
|
public async Task CanGetRates()
|
||||||
|
|||||||
@@ -55,11 +55,11 @@ namespace BTCPayServer.Controllers
|
|||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet]
|
[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
|
// waiting for event handler to catch up
|
||||||
await Task.Delay(1000);
|
await Task.Delay(500);
|
||||||
return RedirectToAction(nameof(Index));
|
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>
|
<button type="submit" class="dropdown-item" name="command" value="delete"><i class="fa fa-trash-o"></i> Delete</button>
|
||||||
</div>
|
</div>
|
||||||
</span>
|
</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>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
|||||||
Reference in New Issue
Block a user