Skip to content

Commit 6ccd32a

Browse files
committed
Check commiter name for MR and Note triggered builds
1 parent d196355 commit 6ccd32a

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

src/test/java/com/dabsquared/gitlabjenkins/webhook/build/MergeRequestBuildActionTest.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,21 @@ public void build() throws IOException {
111111
assertThat(pushHookArgumentCaptor.getValue().getUser(), is(notNullValue()));
112112
assertThat(pushHookArgumentCaptor.getValue().getUser().getName(), containsString("Administrator"));
113113
assertThat(pushHookArgumentCaptor.getValue().getUser().getUsername(), containsString("root"));
114+
assertThat(
115+
pushHookArgumentCaptor
116+
.getValue()
117+
.getObjectAttributes()
118+
.getLastCommit()
119+
.getAuthor(),
120+
is(notNullValue()));
121+
assertThat(
122+
pushHookArgumentCaptor
123+
.getValue()
124+
.getObjectAttributes()
125+
.getLastCommit()
126+
.getAuthor()
127+
.getName(),
128+
containsString("GitLab dev user"));
114129
}
115130
}
116131

src/test/java/com/dabsquared/gitlabjenkins/webhook/build/NoteBuildActionTest.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,21 @@ public void build() throws IOException {
8585
assertThat(noteHookArgumentCaptor.getValue().getUser(), is(notNullValue()));
8686
assertThat(noteHookArgumentCaptor.getValue().getUser().getName(), containsString("Administrator"));
8787
assertThat(noteHookArgumentCaptor.getValue().getUser().getUsername(), containsString("root"));
88+
assertThat(
89+
noteHookArgumentCaptor
90+
.getValue()
91+
.getMergeRequest()
92+
.getLastCommit()
93+
.getAuthor(),
94+
is(notNullValue()));
95+
assertThat(
96+
noteHookArgumentCaptor
97+
.getValue()
98+
.getMergeRequest()
99+
.getLastCommit()
100+
.getAuthor()
101+
.getName(),
102+
containsString("John Smith"));
88103
}
89104
}
90105

0 commit comments

Comments
 (0)