mirror of
https://github.com/bitwarden/server.git
synced 2025-06-30 15:42:48 -05:00
Fix Most Test Warnings (#4612)
* Add Collections Tests * Update CollectionRepository Implementation * Test Adding And Deleting Through Replace * Format * Fix Most Test Warnings * Format
This commit is contained in:
@ -21,8 +21,10 @@ public class MembersControllerTests : IClassFixture<ApiApplicationFactory>, IAsy
|
||||
private readonly HttpClient _client;
|
||||
private readonly ApiApplicationFactory _factory;
|
||||
private readonly LoginHelper _loginHelper;
|
||||
private Organization _organization;
|
||||
private string _ownerEmail;
|
||||
|
||||
// These will get set in `InitializeAsync` which is ran before all tests
|
||||
private Organization _organization = null!;
|
||||
private string _ownerEmail = null!;
|
||||
|
||||
public MembersControllerTests(ApiApplicationFactory factory)
|
||||
{
|
||||
@ -74,7 +76,7 @@ public class MembersControllerTests : IClassFixture<ApiApplicationFactory>, IAsy
|
||||
m.Email == _ownerEmail && m.Type == OrganizationUserType.Owner));
|
||||
|
||||
// The custom user
|
||||
var user1Result = result.Data.SingleOrDefault(m => m.Email == userEmail1);
|
||||
var user1Result = result.Data.Single(m => m.Email == userEmail1);
|
||||
Assert.Equal(OrganizationUserType.Custom, user1Result.Type);
|
||||
AssertHelper.AssertPropertyEqual(
|
||||
new PermissionsModel { AccessImportExport = true, ManagePolicies = true, AccessReports = true },
|
||||
@ -156,6 +158,7 @@ public class MembersControllerTests : IClassFixture<ApiApplicationFactory>, IAsy
|
||||
var organizationUserRepository = _factory.GetService<IOrganizationUserRepository>();
|
||||
var orgUser = await organizationUserRepository.GetByIdAsync(result.Id);
|
||||
|
||||
Assert.NotNull(orgUser);
|
||||
Assert.Equal(email, orgUser.Email);
|
||||
Assert.Equal(OrganizationUserType.Custom, orgUser.Type);
|
||||
Assert.Equal("myCustomUser", orgUser.ExternalId);
|
||||
@ -201,6 +204,7 @@ public class MembersControllerTests : IClassFixture<ApiApplicationFactory>, IAsy
|
||||
var organizationUserRepository = _factory.GetService<IOrganizationUserRepository>();
|
||||
var updatedOrgUser = await organizationUserRepository.GetByIdAsync(result.Id);
|
||||
|
||||
Assert.NotNull(updatedOrgUser);
|
||||
Assert.Equal(OrganizationUserType.Custom, updatedOrgUser.Type);
|
||||
Assert.Equal("example", updatedOrgUser.ExternalId);
|
||||
Assert.Equal(OrganizationUserStatusType.Confirmed, updatedOrgUser.Status);
|
||||
@ -240,6 +244,7 @@ public class MembersControllerTests : IClassFixture<ApiApplicationFactory>, IAsy
|
||||
var organizationUserRepository = _factory.GetService<IOrganizationUserRepository>();
|
||||
var updatedOrgUser = await organizationUserRepository.GetByIdAsync(result.Id);
|
||||
|
||||
Assert.NotNull(updatedOrgUser);
|
||||
Assert.Equal(OrganizationUserType.Custom, updatedOrgUser.Type);
|
||||
AssertHelper.AssertPropertyEqual(
|
||||
new Permissions { CreateNewCollections = true, ManageScim = true, ManageGroups = true, ManageUsers = true },
|
||||
|
Reference in New Issue
Block a user