mirror of
https://github.com/bitwarden/server.git
synced 2025-06-30 15:42:48 -05:00
[PM-17562] Add HEC integration support
This commit is contained in:
@ -14,7 +14,7 @@ public class IntegrationMessageTests
|
||||
{
|
||||
var message = new IntegrationMessage<WebhookIntegrationConfigurationDetails>
|
||||
{
|
||||
Configuration = new WebhookIntegrationConfigurationDetails("https://localhost", "Bearer", "AUTH-TOKEN"),
|
||||
Configuration = new WebhookIntegrationConfigurationDetails(new Uri("https://localhost"), "Bearer", "AUTH-TOKEN"),
|
||||
MessageId = _messageId,
|
||||
RetryCount = 2,
|
||||
RenderedTemplate = string.Empty,
|
||||
@ -34,7 +34,7 @@ public class IntegrationMessageTests
|
||||
{
|
||||
var message = new IntegrationMessage<WebhookIntegrationConfigurationDetails>
|
||||
{
|
||||
Configuration = new WebhookIntegrationConfigurationDetails("https://localhost", "Bearer", "AUTH-TOKEN"),
|
||||
Configuration = new WebhookIntegrationConfigurationDetails(new Uri("https://localhost"), "Bearer", "AUTH-TOKEN"),
|
||||
MessageId = _messageId,
|
||||
RenderedTemplate = "This is the message",
|
||||
IntegrationType = IntegrationType.Webhook,
|
||||
|
@ -22,6 +22,22 @@ public class OrganizationIntegrationConfigurationDetailsTests
|
||||
Assert.Equal(expected, result.ToJsonString());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void MergedConfiguration_WithSameKeyIndConfigAndIntegration_GivesPrecedenceToConfiguration()
|
||||
{
|
||||
var config = new { config = "A new config value" };
|
||||
var integration = new { config = "An integration value" };
|
||||
var expectedObj = new { config = "A new config value" };
|
||||
var expected = JsonSerializer.Serialize(expectedObj);
|
||||
|
||||
var sut = new OrganizationIntegrationConfigurationDetails();
|
||||
sut.Configuration = JsonSerializer.Serialize(config);
|
||||
sut.IntegrationConfiguration = JsonSerializer.Serialize(integration);
|
||||
|
||||
var result = sut.MergedConfiguration;
|
||||
Assert.Equal(expected, result.ToJsonString());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void MergedConfiguration_WithInvalidJsonConfigAndIntegration_ReturnsEmptyJson()
|
||||
{
|
||||
|
Reference in New Issue
Block a user