1
0
mirror of https://github.com/bitwarden/server.git synced 2025-04-05 05:00:19 -05:00

Properly qualify namespace (#1328)

This commit is contained in:
Justin Baur 2021-05-13 18:06:16 -04:00 committed by GitHub
parent 0e1ab99e25
commit b3ccc652f4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 27 additions and 26 deletions

View File

@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.Json;
@ -20,7 +20,7 @@ namespace Bit.Core.Test.AutoFixture.OrganizationFixtures
{
var organizationId = Guid.NewGuid();
fixture.Customize<Models.Table.Organization>(composer => composer
fixture.Customize<Core.Models.Table.Organization>(composer => composer
.With(o => o.Id, organizationId)
.With(o => o.UseGroups, UseGroups));
@ -37,7 +37,7 @@ namespace Bit.Core.Test.AutoFixture.OrganizationFixtures
var lowestActivePaidPlan = validUpgradePlans.First();
CheckedPlanType = CheckedPlanType.Equals(Enums.PlanType.Free) ? lowestActivePaidPlan : CheckedPlanType;
validUpgradePlans.Remove(lowestActivePaidPlan);
fixture.Customize<Models.Table.Organization>(composer => composer
fixture.Customize<Core.Models.Table.Organization>(composer => composer
.With(o => o.PlanType, CheckedPlanType));
fixture.Customize<OrganizationUpgrade>(composer => composer
.With(ou => ou.Plan, validUpgradePlans.First()));
@ -48,7 +48,7 @@ namespace Bit.Core.Test.AutoFixture.OrganizationFixtures
{
public void Customize(IFixture fixture)
{
fixture.Customize<Models.Table.Organization>(composer => composer
fixture.Customize<Core.Models.Table.Organization>(composer => composer
.With(o => o.PlanType, PlanType.Free));
var plansToIgnore = new List<PlanType> { PlanType.Free, PlanType.Custom };
@ -57,7 +57,7 @@ namespace Bit.Core.Test.AutoFixture.OrganizationFixtures
fixture.Customize<OrganizationUpgrade>(composer => composer
.With(ou => ou.Plan, selectedPlan.Type)
.With(ou => ou.PremiumAccessAddon, selectedPlan.HasPremiumAccessOption));
fixture.Customize<Models.Table.Organization>(composer => composer
fixture.Customize<Core.Models.Table.Organization>(composer => composer
.Without(o => o.GatewaySubscriptionId));
}
}
@ -73,7 +73,7 @@ namespace Bit.Core.Test.AutoFixture.OrganizationFixtures
{
PropertyNamingPolicy = JsonNamingPolicy.CamelCase,
});
fixture.Customize<Models.Table.Organization>(composer => composer
fixture.Customize<Core.Models.Table.Organization>(composer => composer
.With(o => o.Id, organizationId)
.With(o => o.Seats, (short)100));
fixture.Customize<OrganizationUser>(composer => composer

View File

@ -40,7 +40,7 @@ namespace Bit.Core.Test.Services
var id = Guid.NewGuid();
var collection = new Models.Table.Collection
var collection = new Core.Models.Table.Collection
{
Id = id,
};
@ -55,7 +55,7 @@ namespace Bit.Core.Test.Services
{
// prepare the organization
var testOrganizationId = Guid.NewGuid();
var testOrganization = new Models.Table.Organization
var testOrganization = new Core.Models.Table.Organization
{
Id = testOrganizationId,
};
@ -70,7 +70,7 @@ namespace Bit.Core.Test.Services
_mailService);
// execute
var testCollection = new Models.Table.Collection
var testCollection = new Core.Models.Table.Collection
{
OrganizationId = testOrganizationId,
};
@ -85,7 +85,7 @@ namespace Bit.Core.Test.Services
{
// prepare the organization
var testOrganizationId = Guid.NewGuid();
var testOrganization = new Models.Table.Organization
var testOrganization = new Core.Models.Table.Organization
{
Id = testOrganizationId,
MaxCollections = 2,
@ -102,7 +102,7 @@ namespace Bit.Core.Test.Services
_userRepository,
_mailService);
var testCollection = new Models.Table.Collection { OrganizationId = testOrganizationId };
var testCollection = new Core.Models.Table.Collection { OrganizationId = testOrganizationId };
// verify & expect exception to be thrown
var ex = await Assert.ThrowsAsync<BadRequestException>(() => collectionService.SaveAsync(testCollection));
@ -116,12 +116,12 @@ namespace Bit.Core.Test.Services
{
// prepare the organization
var testOrganizationId = Guid.NewGuid();
var testOrganization = new Models.Table.Organization
var testOrganization = new Core.Models.Table.Organization
{
Id = testOrganizationId,
};
var testUserId = Guid.NewGuid();
var organizationUser = new Models.Table.OrganizationUser
var organizationUser = new Core.Models.Table.OrganizationUser
{
Id = testUserId,
OrganizationId = testOrganizationId,
@ -137,7 +137,7 @@ namespace Bit.Core.Test.Services
_userRepository,
_mailService);
var testCollection = new Models.Table.Collection { OrganizationId = testOrganizationId };
var testCollection = new Core.Models.Table.Collection { OrganizationId = testOrganizationId };
await collectionService.DeleteUserAsync(testCollection, organizationUser.Id);
// verify
@ -149,12 +149,12 @@ namespace Bit.Core.Test.Services
{
// prepare the organization
var testOrganizationId = Guid.NewGuid();
var testOrganization = new Models.Table.Organization
var testOrganization = new Core.Models.Table.Organization
{
Id = testOrganizationId,
};
var testUserId = Guid.NewGuid();
var nonOrganizationUser = new Models.Table.OrganizationUser
var nonOrganizationUser = new Core.Models.Table.OrganizationUser
{
Id = testUserId,
OrganizationId = Guid.NewGuid(),
@ -170,7 +170,7 @@ namespace Bit.Core.Test.Services
_userRepository,
_mailService);
var testCollection = new Models.Table.Collection { OrganizationId = testOrganizationId };
var testCollection = new Core.Models.Table.Collection { OrganizationId = testOrganizationId };
// verify
// invalid user

View File

@ -1,5 +1,6 @@
using System;
using System.Threading.Tasks;
using Bit.Core.Models.Table;
using Bit.Core.Repositories;
using Bit.Core.Services;
using NSubstitute;
@ -18,7 +19,7 @@ namespace Bit.Core.Test.Services
var id = Guid.NewGuid();
var userId = Guid.NewGuid();
var device = new Models.Table.Device
var device = new Device
{
Id = id,
Name = "test device",

View File

@ -73,10 +73,10 @@ namespace Bit.Core.Test.Services
orgUserRepo.GetManyDetailsByOrganizationAsync(id).Returns(existingUsers);
orgUserRepo.GetCountByOrganizationIdAsync(id).Returns(1);
var newUsers = new List<Models.Business.ImportedOrganizationUser>();
newUsers.Add(new Models.Business.ImportedOrganizationUser { Email = "a@test.com", ExternalId = "a" });
newUsers.Add(new Models.Business.ImportedOrganizationUser { Email = "b@test.com", ExternalId = "b" });
newUsers.Add(new Models.Business.ImportedOrganizationUser { Email = "c@test.com", ExternalId = "c" });
var newUsers = new List<ImportedOrganizationUser>();
newUsers.Add(new ImportedOrganizationUser { Email = "a@test.com", ExternalId = "a" });
newUsers.Add(new ImportedOrganizationUser { Email = "b@test.com", ExternalId = "b" });
newUsers.Add(new ImportedOrganizationUser { Email = "c@test.com", ExternalId = "c" });
await orgService.ImportAsync(id, userId, null, newUsers, null, false);
await orgUserRepo.DidNotReceive().UpsertAsync(Arg.Any<OrganizationUser>());
@ -137,10 +137,10 @@ namespace Bit.Core.Test.Services
orgUserRepo.GetCountByOrganizationIdAsync(id).Returns(1);
orgUserRepo.GetByIdAsync(existingUserAId).Returns(new OrganizationUser { Id = existingUserAId });
var newUsers = new List<Models.Business.ImportedOrganizationUser>();
newUsers.Add(new Models.Business.ImportedOrganizationUser { Email = "a@test.com", ExternalId = "a" });
newUsers.Add(new Models.Business.ImportedOrganizationUser { Email = "b@test.com", ExternalId = "b" });
newUsers.Add(new Models.Business.ImportedOrganizationUser { Email = "c@test.com", ExternalId = "c" });
var newUsers = new List<ImportedOrganizationUser>();
newUsers.Add(new ImportedOrganizationUser { Email = "a@test.com", ExternalId = "a" });
newUsers.Add(new ImportedOrganizationUser { Email = "b@test.com", ExternalId = "b" });
newUsers.Add(new ImportedOrganizationUser { Email = "c@test.com", ExternalId = "c" });
await orgService.ImportAsync(id, userId, null, newUsers, null, false);
await orgUserRepo.Received(1).UpsertAsync(Arg.Any<OrganizationUser>());