1
0
mirror of https://github.com/bitwarden/server.git synced 2025-05-31 08:10:32 -05:00

Fix tests

This commit is contained in:
Hinton 2025-05-27 12:46:29 +02:00
parent edc4b567ef
commit b4618b31be
No known key found for this signature in database
GPG Key ID: 5F7295599C5D965C
2 changed files with 9 additions and 0 deletions

View File

@ -5,6 +5,7 @@ using Bit.IntegrationTestCommon;
using Bit.IntegrationTestCommon.Factories; using Bit.IntegrationTestCommon.Factories;
using Microsoft.AspNetCore.Authentication.JwtBearer; using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.AspNetCore.TestHost; using Microsoft.AspNetCore.TestHost;
using Xunit;
#nullable enable #nullable enable
@ -50,6 +51,10 @@ public class ApiApplicationFactory : WebApplicationFactoryBase<Startup>
public async Task<(string Token, string RefreshToken)> LoginWithNewAccount( public async Task<(string Token, string RefreshToken)> LoginWithNewAccount(
string email = "integration-test@bitwarden.com", string masterPasswordHash = "master_password_hash") string email = "integration-test@bitwarden.com", string masterPasswordHash = "master_password_hash")
{ {
// This might be the first action in a test and since it forwards to the Identity server, we need to ensure that
// this server is initialized since it's responsible for seeding the database.
Assert.NotNull(Services);
await _identityApplicationFactory.RegisterNewIdentityFactoryUserAsync( await _identityApplicationFactory.RegisterNewIdentityFactoryUserAsync(
new RegisterFinishRequestModel new RegisterFinishRequestModel
{ {

View File

@ -45,6 +45,10 @@ public class EventsApplicationFactory : WebApplicationFactoryBase<Startup>
/// </summary> /// </summary>
public async Task<(string Token, string RefreshToken)> LoginWithNewAccount(string email = "integration-test@bitwarden.com", string masterPasswordHash = "master_password_hash") public async Task<(string Token, string RefreshToken)> LoginWithNewAccount(string email = "integration-test@bitwarden.com", string masterPasswordHash = "master_password_hash")
{ {
// This might be the first action in a test and since it forwards to the Identity server, we need to ensure that
// this server is initialized since it's responsible for seeding the database.
Assert.NotNull(Services);
await _identityApplicationFactory.RegisterNewIdentityFactoryUserAsync( await _identityApplicationFactory.RegisterNewIdentityFactoryUserAsync(
new RegisterFinishRequestModel new RegisterFinishRequestModel
{ {