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

Updated with changes from PR comments

This commit is contained in:
Brant DeBow 2025-04-02 09:31:35 -04:00
parent de7c2f7063
commit 3957f81d6b
No known key found for this signature in database
GPG Key ID: 94411BB25947C72B
5 changed files with 10 additions and 10 deletions

View File

@ -36,7 +36,7 @@ public class OrganizationIntegrationConfigurationDetails
{ {
try try
{ {
var configuration = Configuration ?? "{}"; var configuration = Configuration ?? string.Empty;
return JsonNode.Parse(configuration) as JsonObject ?? new JsonObject(); return JsonNode.Parse(configuration) as JsonObject ?? new JsonObject();
} }
catch catch
@ -52,7 +52,7 @@ public class OrganizationIntegrationConfigurationDetails
{ {
try try
{ {
var integration = IntegrationConfiguration ?? "{}"; var integration = IntegrationConfiguration ?? string.Empty;
return JsonNode.Parse(integration) as JsonObject ?? new JsonObject(); return JsonNode.Parse(integration) as JsonObject ?? new JsonObject();
} }
catch catch

View File

@ -6,7 +6,7 @@ namespace Bit.Core.Repositories;
public interface IOrganizationIntegrationConfigurationRepository : IRepository<OrganizationIntegrationConfiguration, Guid> public interface IOrganizationIntegrationConfigurationRepository : IRepository<OrganizationIntegrationConfiguration, Guid>
{ {
Task<List<OrganizationIntegrationConfigurationDetails>> GetConfigurationsAsync( Task<List<OrganizationIntegrationConfigurationDetails>> GetConfigurationDetailsAsync(
Guid organizationId, Guid organizationId,
IntegrationType integrationType, IntegrationType integrationType,
EventType eventType); EventType eventType);

View File

@ -20,7 +20,7 @@ public class OrganizationIntegrationConfigurationRepository : Repository<Organiz
: base(connectionString, readOnlyConnectionString) : base(connectionString, readOnlyConnectionString)
{ } { }
public async Task<List<OrganizationIntegrationConfigurationDetails>> GetConfigurationsAsync( public async Task<List<OrganizationIntegrationConfigurationDetails>> GetConfigurationDetailsAsync(
Guid organizationId, Guid organizationId,
IntegrationType integrationType, IntegrationType integrationType,
EventType eventType) EventType eventType)

View File

@ -16,7 +16,7 @@ public class OrganizationIntegrationConfigurationRepository : Repository<Core.Ad
: base(serviceScopeFactory, mapper, context => context.OrganizationIntegrationConfigurations) : base(serviceScopeFactory, mapper, context => context.OrganizationIntegrationConfigurations)
{ } { }
public async Task<List<OrganizationIntegrationConfigurationDetails>> GetConfigurationsAsync( public async Task<List<OrganizationIntegrationConfigurationDetails>> GetConfigurationDetailsAsync(
Guid organizationId, Guid organizationId,
IntegrationType integrationType, IntegrationType integrationType,
EventType eventType) EventType eventType)

View File

@ -7,7 +7,7 @@ namespace Bit.Core.Test.Models.Data.Organizations;
public class OrganizationIntegrationConfigurationDetailsTests public class OrganizationIntegrationConfigurationDetailsTests
{ {
[Fact] [Fact]
public void MergedConfiguration_BothHaveValues() public void MergedConfiguration_WithValidConfigAndIntegration_ReturnsMergedJson()
{ {
var config = new { config = "A new config value" }; var config = new { config = "A new config value" };
var integration = new { integration = "An integration value" }; var integration = new { integration = "An integration value" };
@ -23,7 +23,7 @@ public class OrganizationIntegrationConfigurationDetailsTests
} }
[Fact] [Fact]
public void MergedConfiguration_BothNotJson() public void MergedConfiguration_WithInvalidJsonConfigAndIntegration_ReturnsEmptyJson()
{ {
var expectedObj = new { }; var expectedObj = new { };
var expected = JsonSerializer.Serialize(expectedObj); var expected = JsonSerializer.Serialize(expectedObj);
@ -37,7 +37,7 @@ public class OrganizationIntegrationConfigurationDetailsTests
} }
[Fact] [Fact]
public void MergedConfiguration_BothNull() public void MergedConfiguration_WithNullConfigAndIntegration_ReturnsEmptyJson()
{ {
var expectedObj = new { }; var expectedObj = new { };
var expected = JsonSerializer.Serialize(expectedObj); var expected = JsonSerializer.Serialize(expectedObj);
@ -51,7 +51,7 @@ public class OrganizationIntegrationConfigurationDetailsTests
} }
[Fact] [Fact]
public void MergedConfiguration_ConfigNull() public void MergedConfiguration_WithValidIntegrationAndNullConfig_ReturnsIntegrationJson()
{ {
var integration = new { integration = "An integration value" }; var integration = new { integration = "An integration value" };
var expectedObj = new { integration = "An integration value" }; var expectedObj = new { integration = "An integration value" };
@ -66,7 +66,7 @@ public class OrganizationIntegrationConfigurationDetailsTests
} }
[Fact] [Fact]
public void MergedConfiguration_IntegrationNull() public void MergedConfiguration_WithValidConfigAndNullIntegration_ReturnsConfigJson()
{ {
var config = new { config = "A new config value" }; var config = new { config = "A new config value" };
var expectedObj = new { config = "A new config value" }; var expectedObj = new { config = "A new config value" };