1
0
mirror of https://github.com/bitwarden/server.git synced 2025-01-07 19:37:51 +01:00
bitwarden-server/test/Identity.IntegrationTest/Controllers/AccountsControllerTests.cs

35 lines
991 B
C#
Raw Normal View History

using Bit.Core.Models.Api.Request.Accounts;
using Bit.IntegrationTestCommon.Factories;
using Microsoft.EntityFrameworkCore;
using Xunit;
2022-08-29 22:06:55 +02:00
namespace Bit.Identity.IntegrationTest.Controllers;
public class AccountsControllerTests : IClassFixture<IdentityApplicationFactory>
{
2022-08-29 22:06:55 +02:00
private readonly IdentityApplicationFactory _factory;
2022-08-29 22:06:55 +02:00
public AccountsControllerTests(IdentityApplicationFactory factory)
{
_factory = factory;
}
2022-08-29 22:06:55 +02:00
[Fact]
public async Task PostRegister_Success()
{
var context = await _factory.RegisterAsync(new RegisterRequestModel
{
2022-08-29 22:06:55 +02:00
Email = "test+register@email.com",
MasterPasswordHash = "master_password_hash"
});
2022-08-29 22:06:55 +02:00
Assert.Equal(StatusCodes.Status200OK, context.Response.StatusCode);
2022-08-29 22:06:55 +02:00
var database = _factory.GetDatabaseContext();
var user = await database.Users
.SingleAsync(u => u.Email == "test+register@email.com");
2022-08-29 22:06:55 +02:00
Assert.NotNull(user);
}
}