public void ShouldGetNull(string jsonDocument, bool isApplicable) { // Given var jsonElement = JsonDocument.Parse(jsonDocument).RootElement; // When var authenticationProvider = new Base64Provider(jsonElement, TestcontainersSettings.Logger); var authConfig = authenticationProvider.GetAuthConfig(DockerRegistry); // Then Assert.Equal(isApplicable, authenticationProvider.IsApplicable(DockerRegistry)); Assert.Null(authConfig); }
public void ShouldGetAuthConfig() { // Given const string jsonDocument = "{\"auths\":{\"" + DockerRegistry + "\":{\"auth\":\"dXNlcm5hbWU6cGFzc3dvcmQ=\"}}}"; var jsonElement = JsonDocument.Parse(jsonDocument).RootElement; // When var authenticationProvider = new Base64Provider(jsonElement, TestcontainersSettings.Logger); var authConfig = authenticationProvider.GetAuthConfig(DockerRegistry); // Then Assert.True(authenticationProvider.IsApplicable(DockerRegistry)); Assert.NotNull(authConfig); Assert.Equal(DockerRegistry, authConfig.RegistryEndpoint); Assert.Equal("username", authConfig.Username); Assert.Equal("password", authConfig.Password); }