Search in sources :

Example 1 with GithubSecurityRealm

use of org.jenkinsci.plugins.GithubSecurityRealm in project configuration-as-code-plugin by jenkinsci.

the class GithubOAuthTest method testSampleVersionForOAuth.

@Test
@ConfiguredWithCode("GithubOAuth.yml")
public void testSampleVersionForOAuth() {
    SecurityRealm realm = Jenkins.getInstance().getSecurityRealm();
    assertThat(realm, instanceOf(GithubSecurityRealm.class));
    GithubSecurityRealm gsh = (GithubSecurityRealm) realm;
    assertEquals("someId", gsh.getClientID());
    assertEquals("https://api.github.com", gsh.getGithubApiUri());
    assertEquals("https://github.com", gsh.getGithubWebUri());
    assertEquals("j985j8fhfhh377", gsh.getClientSecret().getPlainText());
    assertEquals("read:org,user:email", gsh.getOauthScopes());
}
Also used : GithubSecurityRealm(org.jenkinsci.plugins.GithubSecurityRealm) SecurityRealm(hudson.security.SecurityRealm) GithubSecurityRealm(org.jenkinsci.plugins.GithubSecurityRealm) Test(org.junit.Test) ConfiguredWithCode(org.jenkinsci.plugins.casc.misc.ConfiguredWithCode)

Aggregations

SecurityRealm (hudson.security.SecurityRealm)1 GithubSecurityRealm (org.jenkinsci.plugins.GithubSecurityRealm)1 ConfiguredWithCode (org.jenkinsci.plugins.casc.misc.ConfiguredWithCode)1 Test (org.junit.Test)1