Small improvements to make development of plugins easier (#6270)

This commit is contained in:
Nicolas Dorier 2024-10-03 15:16:21 +09:00 committed by GitHub
parent 3a71c45a89
commit 1ffbab7338
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 8 additions and 3 deletions

View file

@ -162,6 +162,8 @@ namespace BTCPayServer.Tests
HttpClient.BaseAddress = ServerUri;
Environment.SetEnvironmentVariable("ASPNETCORE_ENVIRONMENT", "Development");
var confBuilder = new DefaultConfiguration() { Logger = LoggerProvider.CreateLogger("Console") }.CreateConfigurationBuilder(new[] { "--datadir", _Directory, "--conf", confPath, "--disable-registration", DisableRegistration ? "true" : "false" });
// This make sure that tests work outside of this assembly (ie, test project it a plugin)
confBuilder.SetBasePath(Directory.GetCurrentDirectory());
#if DEBUG
confBuilder.AddJsonFile("appsettings.dev.json", true, false);
#endif

View file

@ -132,11 +132,11 @@ retry:
/// Because for some reason, the selenium container can't resolve the tests container domain name
/// </summary>
public Uri ServerUri;
internal IWebElement FindAlertMessage(StatusMessageModel.StatusSeverity severity = StatusMessageModel.StatusSeverity.Success)
public IWebElement FindAlertMessage(StatusMessageModel.StatusSeverity severity = StatusMessageModel.StatusSeverity.Success)
{
return FindAlertMessage(new[] { severity });
}
internal IWebElement FindAlertMessage(params StatusMessageModel.StatusSeverity[] severity)
public IWebElement FindAlertMessage(params StatusMessageModel.StatusSeverity[] severity)
{
var className = string.Join(", ", severity.Select(statusSeverity => $".alert-{StatusMessageModel.ToString(statusSeverity)}"));
IWebElement el;
@ -182,10 +182,13 @@ retry:
Driver.FindElement(By.Id("RegisterButton")).Click();
Driver.AssertNoError();
CreatedUser = usr;
Password = "123456";
return usr;
}
string CreatedUser;
public string Password { get; private set; }
public TestAccount AsTestAccount()
{
return new TestAccount(Server) { RegisterDetails = new Models.AccountViewModels.RegisterViewModel() { Password = "123456", Email = CreatedUser } };

View file

@ -23,7 +23,7 @@ public static class SettingsRepositoryExtensions
}
return new IssuerKey(issuerKey);
}
internal static AESKey FixedKey()
public static AESKey FixedKey()
{
byte[] v = new byte[16];
v[0] = 1;