Skip to content
Permalink
Browse files
JENKINS-7824 testcase to prove default assignee is yourself
  • Loading branch information
Marc Carter committed Jun 24, 2014
1 parent d8d1054 commit cc86aacef6cd87c70fea5ee0ce7c19679969953f
Showing 2 changed files with 10 additions and 3 deletions.
@@ -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>
@@ -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();

@@ -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));
@@ -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 {
@@ -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;
}

0 comments on commit cc86aac

Please sign in to comment.