mirror of
https://github.com/bitwarden/server.git
synced 2024-12-01 13:43:23 +01:00
1f0fc43278
Long lived feature branch for Secrets Manager Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com> Co-authored-by: cd-bitwarden <106776772+cd-bitwarden@users.noreply.github.com> Co-authored-by: CarleyDiaz-Bitwarden <103955722+CarleyDiaz-Bitwarden@users.noreply.github.com> Co-authored-by: Thomas Avery <tavery@bitwarden.com> Co-authored-by: Colton Hurst <colton@coltonhurst.com>
41 lines
1.4 KiB
C#
41 lines
1.4 KiB
C#
using System.Net.Http.Headers;
|
|
using Bit.Api.IntegrationTest.Factories;
|
|
using Bit.Api.Models.Response;
|
|
using Xunit;
|
|
|
|
namespace Bit.Api.IntegrationTest.Controllers;
|
|
|
|
public class AccountsControllerTest : IClassFixture<ApiApplicationFactory>
|
|
{
|
|
private readonly ApiApplicationFactory _factory;
|
|
|
|
public AccountsControllerTest(ApiApplicationFactory factory) => _factory = factory;
|
|
|
|
[Fact]
|
|
public async Task GetPublicKey()
|
|
{
|
|
var tokens = await _factory.LoginWithNewAccount();
|
|
var client = _factory.CreateClient();
|
|
|
|
using var message = new HttpRequestMessage(HttpMethod.Get, "/accounts/profile");
|
|
message.Headers.Authorization = new AuthenticationHeaderValue("Bearer", tokens.Token);
|
|
var response = await client.SendAsync(message);
|
|
|
|
response.EnsureSuccessStatusCode();
|
|
|
|
var content = await response.Content.ReadFromJsonAsync<ProfileResponseModel>();
|
|
|
|
Assert.NotEmpty(content!.Id);
|
|
Assert.Equal("integration-test@bitwarden.com", content.Email);
|
|
Assert.Null(content.Name);
|
|
Assert.False(content.EmailVerified);
|
|
Assert.False(content.Premium);
|
|
Assert.False(content.PremiumFromOrganization);
|
|
Assert.Null(content.MasterPasswordHint);
|
|
Assert.Equal("en-US", content.Culture);
|
|
Assert.Null(content.Key);
|
|
Assert.Null(content.PrivateKey);
|
|
Assert.NotNull(content.SecurityStamp);
|
|
}
|
|
}
|