mirror of
https://github.com/bitwarden/server.git
synced 2026-04-12 20:53:32 -05:00
* add fillAssistRules to environment URIs in config * add tests * do not include json file specification in path * fix warnings
41 lines
1.1 KiB
C#
41 lines
1.1 KiB
C#
using System.Text.Json;
|
|
using Bit.Api.Models.Response;
|
|
using Xunit;
|
|
|
|
namespace Bit.Api.Test.Models.Response;
|
|
|
|
public class EnvironmentConfigResponseModelTests
|
|
{
|
|
[Fact]
|
|
public void Serialize_FillAssistRulesNull_OmitsPropertyFromJson()
|
|
{
|
|
var model = new EnvironmentConfigResponseModel
|
|
{
|
|
CloudRegion = "US",
|
|
Vault = "https://vault.bitwarden.com",
|
|
FillAssistRules = null
|
|
};
|
|
|
|
var json = JsonSerializer.Serialize(model);
|
|
|
|
Assert.DoesNotContain("FillAssistRules", json, StringComparison.OrdinalIgnoreCase);
|
|
}
|
|
|
|
[Fact]
|
|
public void Serialize_FillAssistRulesSet_IncludesPropertyInJson()
|
|
{
|
|
var expectedUri = "https://example.com/rules.json";
|
|
var model = new EnvironmentConfigResponseModel
|
|
{
|
|
CloudRegion = "US",
|
|
Vault = "https://vault.bitwarden.com",
|
|
FillAssistRules = expectedUri
|
|
};
|
|
|
|
var json = JsonSerializer.Serialize(model);
|
|
|
|
Assert.Contains("FillAssistRules", json);
|
|
Assert.Contains(expectedUri, json);
|
|
}
|
|
}
|