mirror of
https://github.com/bitwarden/server.git
synced 2024-11-29 13:25:17 +01:00
Fix broken tests
This commit is contained in:
parent
0255a2ea15
commit
aefcbcbe7d
@ -13,8 +13,6 @@ using Bit.Core.Models.Table;
|
|||||||
using Bit.Core.Models.Table.Provider;
|
using Bit.Core.Models.Table.Provider;
|
||||||
using Bit.Core.Repositories;
|
using Bit.Core.Repositories;
|
||||||
using Bit.Core.Services;
|
using Bit.Core.Services;
|
||||||
using Bit.Core.Test.AutoFixture;
|
|
||||||
using Bit.Core.Test.AutoFixture.Attributes;
|
|
||||||
using Bit.Core.Utilities;
|
using Bit.Core.Utilities;
|
||||||
using Microsoft.AspNetCore.DataProtection;
|
using Microsoft.AspNetCore.DataProtection;
|
||||||
using NSubstitute;
|
using NSubstitute;
|
||||||
@ -22,6 +20,8 @@ using NSubstitute.ReturnsExtensions;
|
|||||||
using Xunit;
|
using Xunit;
|
||||||
using ProviderUser = Bit.Core.Models.Table.Provider.ProviderUser;
|
using ProviderUser = Bit.Core.Models.Table.Provider.ProviderUser;
|
||||||
using Bit.Core.Context;
|
using Bit.Core.Context;
|
||||||
|
using Bit.Test.Common.AutoFixture;
|
||||||
|
using Bit.Test.Common.AutoFixture.Attributes;
|
||||||
|
|
||||||
namespace Bit.CommCore.Test.Services
|
namespace Bit.CommCore.Test.Services
|
||||||
{
|
{
|
||||||
|
@ -40,8 +40,8 @@ namespace Bit.Api.Test.Controllers
|
|||||||
|
|
||||||
Assert.Contains("Specified Organization cannot sponsor other organizations.", exception.Message);
|
Assert.Contains("Specified Organization cannot sponsor other organizations.", exception.Message);
|
||||||
await sutProvider.GetDependency<IOrganizationSponsorshipService>()
|
await sutProvider.GetDependency<IOrganizationSponsorshipService>()
|
||||||
.OfferSponsorshipAsync(default, default, default)
|
.DidNotReceiveWithAnyArgs()
|
||||||
.DidNotReceiveWithAnyArgs();
|
.OfferSponsorshipAsync(default, default, default);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IEnumerable<object[]> NonConfirmedOrganizationUsersStatuses =>
|
public static IEnumerable<object[]> NonConfirmedOrganizationUsersStatuses =>
|
||||||
@ -69,8 +69,8 @@ namespace Bit.Api.Test.Controllers
|
|||||||
|
|
||||||
Assert.Contains("Only confirm users can sponsor other organizations.", exception.Message);
|
Assert.Contains("Only confirm users can sponsor other organizations.", exception.Message);
|
||||||
await sutProvider.GetDependency<IOrganizationSponsorshipService>()
|
await sutProvider.GetDependency<IOrganizationSponsorshipService>()
|
||||||
.OfferSponsorshipAsync(default, default, default)
|
.DidNotReceiveWithAnyArgs()
|
||||||
.DidNotReceiveWithAnyArgs();
|
.OfferSponsorshipAsync(default, default, default);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Theory]
|
[Theory]
|
||||||
@ -92,8 +92,8 @@ namespace Bit.Api.Test.Controllers
|
|||||||
|
|
||||||
Assert.Contains("Can only create organization sponsorships for yourself.", exception.Message);
|
Assert.Contains("Can only create organization sponsorships for yourself.", exception.Message);
|
||||||
await sutProvider.GetDependency<IOrganizationSponsorshipService>()
|
await sutProvider.GetDependency<IOrganizationSponsorshipService>()
|
||||||
.OfferSponsorshipAsync(default, default, default)
|
.DidNotReceiveWithAnyArgs()
|
||||||
.DidNotReceiveWithAnyArgs();
|
.OfferSponsorshipAsync(default, default, default);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Theory]
|
[Theory]
|
||||||
@ -117,8 +117,8 @@ namespace Bit.Api.Test.Controllers
|
|||||||
|
|
||||||
Assert.Contains("Can only sponsor one organization per Organization User.", exception.Message);
|
Assert.Contains("Can only sponsor one organization per Organization User.", exception.Message);
|
||||||
await sutProvider.GetDependency<IOrganizationSponsorshipService>()
|
await sutProvider.GetDependency<IOrganizationSponsorshipService>()
|
||||||
.OfferSponsorshipAsync(default, default, default)
|
.DidNotReceiveWithAnyArgs()
|
||||||
.DidNotReceiveWithAnyArgs();
|
.OfferSponsorshipAsync(default, default, default);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Test redeem sponsorship
|
// TODO: Test redeem sponsorship
|
||||||
@ -137,8 +137,8 @@ namespace Bit.Api.Test.Controllers
|
|||||||
|
|
||||||
Assert.Contains("Can only revoke a sponsorship you granted.", exception.Message);
|
Assert.Contains("Can only revoke a sponsorship you granted.", exception.Message);
|
||||||
await sutProvider.GetDependency<IOrganizationSponsorshipService>()
|
await sutProvider.GetDependency<IOrganizationSponsorshipService>()
|
||||||
.RemoveSponsorshipAsync(default)
|
.DidNotReceiveWithAnyArgs()
|
||||||
.DidNotReceiveWithAnyArgs();
|
.RemoveSponsorshipAsync(default);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Theory]
|
[Theory]
|
||||||
@ -161,8 +161,8 @@ namespace Bit.Api.Test.Controllers
|
|||||||
|
|
||||||
Assert.Contains("You are not currently sponsoring and organization.", exception.Message);
|
Assert.Contains("You are not currently sponsoring and organization.", exception.Message);
|
||||||
await sutProvider.GetDependency<IOrganizationSponsorshipService>()
|
await sutProvider.GetDependency<IOrganizationSponsorshipService>()
|
||||||
.RemoveSponsorshipAsync(default)
|
.DidNotReceiveWithAnyArgs()
|
||||||
.DidNotReceiveWithAnyArgs();
|
.RemoveSponsorshipAsync(default);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Theory]
|
[Theory]
|
||||||
@ -177,8 +177,8 @@ namespace Bit.Api.Test.Controllers
|
|||||||
|
|
||||||
Assert.Contains("Only the owner of an organization can remove sponsorship.", exception.Message);
|
Assert.Contains("Only the owner of an organization can remove sponsorship.", exception.Message);
|
||||||
await sutProvider.GetDependency<IOrganizationSponsorshipService>()
|
await sutProvider.GetDependency<IOrganizationSponsorshipService>()
|
||||||
.RemoveSponsorshipAsync(default)
|
.DidNotReceiveWithAnyArgs()
|
||||||
.DidNotReceiveWithAnyArgs();
|
.RemoveSponsorshipAsync(default);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Theory]
|
[Theory]
|
||||||
@ -199,8 +199,8 @@ namespace Bit.Api.Test.Controllers
|
|||||||
|
|
||||||
Assert.Contains("The requested organization is not currently being sponsored.", exception.Message);
|
Assert.Contains("The requested organization is not currently being sponsored.", exception.Message);
|
||||||
await sutProvider.GetDependency<IOrganizationSponsorshipService>()
|
await sutProvider.GetDependency<IOrganizationSponsorshipService>()
|
||||||
.RemoveSponsorshipAsync(default)
|
.DidNotReceiveWithAnyArgs()
|
||||||
.DidNotReceiveWithAnyArgs();
|
.RemoveSponsorshipAsync(default);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user