Skip to content

Commit

Permalink
JENKINS-7824 testcase to prove default assignee is yourself
Browse files Browse the repository at this point in the history
  • Loading branch information
Marc Carter committed Jun 24, 2014
1 parent d8d1054 commit cc86aac
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>plugin</artifactId>
<version>1.542</version>
<version>1.490</version>
</parent>

<artifactId>claim</artifactId>
Expand Down
11 changes: 9 additions & 2 deletions src/test/java/hudson/plugins/claim/ClaimTest.java
Expand Up @@ -59,6 +59,8 @@ public void setUp() throws Exception {
j.jenkins.setAuthorizationStrategy(new FullControlOnceLoggedInAuthorizationStrategy());
j.jenkins.setSecurityRealm(j.createDummySecurityRealm());
JenkinsRule.WebClient wc = j.createWebClient();
// Three users exist, we will be user1 so ensure the others have logged on
wc.login("user0", "user0");
wc.login("user2", "user2");
wc.closeAllWindows();

Expand All @@ -76,7 +78,7 @@ public void failed_build_with_claim_publisher_has_claim_action() {
@Test
public void failed_build_can_be_claimed_by_you() throws Exception {
// When:
ClaimBuildAction action = whenClaimingBuildByClicking("claim");
ClaimBuildAction action = whenClaimingBuild();
// Then:
assertThat(action.getClaimedBy(), is("user1"));
assertThat(action.getReason(), is(claimText));
Expand Down Expand Up @@ -166,8 +168,12 @@ private ClaimBuildAction givenBuildClaimedByCurrentUser() {
return action;
}

private ClaimBuildAction whenClaimingBuild() throws Exception {
return applyClaim("claim", null, claimText);
}

private ClaimBuildAction whenClaimingBuildByClicking(String claimElement) throws Exception {
return applyClaim(claimElement, "", claimText);
return applyClaim(claimElement, "user1", claimText);
}

private ClaimBuildAction whenAssigningBuildByClicking(String claimElement) throws Exception {
Expand Down Expand Up @@ -197,6 +203,7 @@ private HtmlPage whenNavigatingToClaimPageAndClicking(String claimElement) throw
JenkinsRule.WebClient wc = j.createWebClient();
wc.login("user1", "user1");
HtmlPage page = wc.goTo("job/x/" + build.getNumber());
// expand claim HTML box
page.getElementById(claimElement).click();
return page;
}
Expand Down

0 comments on commit cc86aac

Please sign in to comment.