mirror of
https://github.com/bitwarden/server.git
synced 2025-06-30 15:42:48 -05:00
[EC-826] Merge license sync feature branch to master (#2587)
* [EC-634] Extract GenerateLicenseAsync to a query (#2373) * [EC-637] Add license sync to server (#2453) * [EC-1036] Show correct license sync date (#2626) * Update method name per new pattern
This commit is contained in:
78
test/Core.Test/Entities/OrganizationConnectionTests.cs
Normal file
78
test/Core.Test/Entities/OrganizationConnectionTests.cs
Normal file
@ -0,0 +1,78 @@
|
||||
using Bit.Core.Entities;
|
||||
using Bit.Core.Enums;
|
||||
using Bit.Core.Models.OrganizationConnectionConfigs;
|
||||
using Bit.Test.Common.AutoFixture.Attributes;
|
||||
using Xunit;
|
||||
|
||||
namespace Bit.Core.Test.Entities;
|
||||
|
||||
public class OrganizationConnectionTests
|
||||
{
|
||||
[Theory]
|
||||
[BitAutoData]
|
||||
public void OrganizationConnection_CanUse_Success(Guid connectionId, Guid organizationId)
|
||||
{
|
||||
var connection = new OrganizationConnection<ScimConfig>()
|
||||
{
|
||||
Id = connectionId,
|
||||
OrganizationId = organizationId,
|
||||
Enabled = true,
|
||||
Type = OrganizationConnectionType.Scim,
|
||||
Config = new ScimConfig() { Enabled = true }
|
||||
};
|
||||
|
||||
Assert.True(connection.Validate<ScimConfig>(out var exception));
|
||||
Assert.True(string.IsNullOrEmpty(exception));
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[BitAutoData]
|
||||
public void OrganizationConnection_CanUse_WhenDisabled_ReturnsFalse(Guid connectionId, Guid organizationId)
|
||||
{
|
||||
|
||||
var connection = new OrganizationConnection<ScimConfig>()
|
||||
{
|
||||
Id = connectionId,
|
||||
OrganizationId = organizationId,
|
||||
Enabled = false,
|
||||
Type = OrganizationConnectionType.Scim,
|
||||
Config = new ScimConfig() { Enabled = true }
|
||||
};
|
||||
|
||||
Assert.False(connection.Validate<ScimConfig>(out var exception));
|
||||
Assert.Contains("Connection disabled", exception);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[BitAutoData]
|
||||
public void OrganizationConnection_CanUse_WhenNoConfig_ReturnsFalse(Guid connectionId, Guid organizationId)
|
||||
{
|
||||
var connection = new OrganizationConnection<ScimConfig>()
|
||||
{
|
||||
Id = connectionId,
|
||||
OrganizationId = organizationId,
|
||||
Enabled = true,
|
||||
Type = OrganizationConnectionType.Scim,
|
||||
};
|
||||
|
||||
Assert.False(connection.Validate<ScimConfig>(out var exception));
|
||||
Assert.Contains("No saved Connection config", exception);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[BitAutoData]
|
||||
public void OrganizationConnection_CanUse_WhenConfigInvalid_ReturnsFalse(Guid connectionId, Guid organizationId)
|
||||
{
|
||||
var connection = new OrganizationConnection<ScimConfig>()
|
||||
{
|
||||
Id = connectionId,
|
||||
OrganizationId = organizationId,
|
||||
Enabled = true,
|
||||
Type = OrganizationConnectionType.Scim,
|
||||
Config = new ScimConfig() { Enabled = false }
|
||||
};
|
||||
|
||||
Assert.False(connection.Validate<ScimConfig>(out var exception));
|
||||
Assert.Contains("Scim Config is disabled", exception);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user