public void GitLabHostProvider_GetSupportedAuthenticationModes_DotCom_ReturnsDotComModes() { Uri targetUri = GitLabConstants.GitLabDotCom; AuthenticationModes expected = GitLabConstants.DotComAuthenticationModes; var context = new TestCommandContext(); var provider = new GitLabHostProvider(context); AuthenticationModes actual = provider.GetSupportedAuthenticationModes(targetUri); Assert.Equal(expected, actual); }
public void GitLabHostProvider_GetSupportedAuthenticationModes_Custom_NoOAuthConfig_ReturnsBasicPat() { var targetUri = new Uri("https://gitlab.example.com"); var expected = AuthenticationModes.Basic | AuthenticationModes.Pat; var context = new TestCommandContext(); var provider = new GitLabHostProvider(context); AuthenticationModes actual = provider.GetSupportedAuthenticationModes(targetUri); Assert.Equal(expected, actual); }
public void GitLabHostProvider_GetSupportedAuthenticationModes_Custom_WithOAuthConfig_ReturnsBasicPatBrowser() { var targetUri = new Uri("https://gitlab.example.com"); var expected = AuthenticationModes.Basic | AuthenticationModes.Pat | AuthenticationModes.Browser; var context = new TestCommandContext(); context.Environment.Variables[GitLabConstants.EnvironmentVariables.DevOAuthClientId] = "abcdefg1234567"; var provider = new GitLabHostProvider(context); AuthenticationModes actual = provider.GetSupportedAuthenticationModes(targetUri); Assert.Equal(expected, actual); }