Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
佳 邓
Gitlab4j Api
Commits
dbee5bad
Unverified
Commit
dbee5bad
authored
Jul 10, 2021
by
Gautier de Saint Martin Lacaze
Committed by
GitHub
Jul 10, 2021
Browse files
Merge pull request #727 from BuzMack/master
Updating System Hook tests with commentary
parents
5eb4aa7f
91eb7e09
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/test/java/org/gitlab4j/api/TestSystemHooksApi.java
View file @
dbee5bad
...
...
@@ -59,15 +59,23 @@ public class TestSystemHooksApi extends AbstractIntegrationTest {
public
void
testAddSystemHook
()
throws
GitLabApiException
{
SystemHook
hook
=
gitLabApi
.
getSystemHooksApi
().
addSystemHook
(
TEST_HOOK_URL
,
TEST_SECRET_TOKEN
,
true
,
false
,
true
);
assertNotNull
(
hook
);
assertEquals
(
TEST_HOOK_URL
,
hook
.
getUrl
());
assertTrue
(
hook
.
getPushEvents
());
assertFalse
(
hook
.
getTagPushEvents
());
assertFalse
(
hook
.
getMergeRequestsEvents
());
assertTrue
(
hook
.
getRepositoryUpdateEvents
());
assertTrue
(
hook
.
getEnableSslVerification
());
gitLabApi
.
getSystemHooksApi
().
deleteSystemHook
(
hook
);
try
{
assertNotNull
(
hook
);
assertEquals
(
TEST_HOOK_URL
,
hook
.
getUrl
());
assertTrue
(
hook
.
getPushEvents
());
assertFalse
(
hook
.
getTagPushEvents
());
assertFalse
(
hook
.
getMergeRequestsEvents
());
// TODO: Attribute "repository_update_events" is not being honored by GitLab API as per issue
// https://gitlab.com/gitlab-org/gitlab/-/issues/335129
// Revisit and update this test if/when the GitLab API/documentation is fixed
assertTrue
(
hook
.
getRepositoryUpdateEvents
());
assertTrue
(
hook
.
getEnableSslVerification
());
}
finally
{
// Ensure we remove the hook we added even if we had failures
gitLabApi
.
getSystemHooksApi
().
deleteSystemHook
(
hook
);
}
hook
.
withPushEvents
(
false
)
.
withTagPushEvents
(
true
)
...
...
@@ -76,15 +84,23 @@ public class TestSystemHooksApi extends AbstractIntegrationTest {
.
withEnableSslVerification
(
false
);
SystemHook
updatedHook
=
gitLabApi
.
getSystemHooksApi
().
addSystemHook
(
TEST_HOOK_URL
,
TEST_SECRET_TOKEN
,
hook
);
assertNotNull
(
updatedHook
);
assertEquals
(
TEST_HOOK_URL
,
updatedHook
.
getUrl
());
assertFalse
(
hook
.
getPushEvents
());
assertTrue
(
hook
.
getTagPushEvents
());
assertTrue
(
hook
.
getMergeRequestsEvents
());
assertFalse
(
hook
.
getRepositoryUpdateEvents
());
assertFalse
(
hook
.
getEnableSslVerification
());
gitLabApi
.
getSystemHooksApi
().
deleteSystemHook
(
updatedHook
);
try
{
assertNotNull
(
updatedHook
);
assertEquals
(
TEST_HOOK_URL
,
updatedHook
.
getUrl
());
assertFalse
(
updatedHook
.
getPushEvents
());
assertTrue
(
updatedHook
.
getTagPushEvents
());
assertTrue
(
updatedHook
.
getMergeRequestsEvents
());
// TODO: Attribute "repository_update_events" is not being honored by GitLab API as per issue
// https://gitlab.com/gitlab-org/gitlab/-/issues/335129
// Revisit and update this test if/when the GitLab API/documentation is fixed
assertTrue
(
updatedHook
.
getRepositoryUpdateEvents
());
assertFalse
(
updatedHook
.
getEnableSslVerification
());
}
finally
{
// Ensure we remove the hook we added even if we had failures
gitLabApi
.
getSystemHooksApi
().
deleteSystemHook
(
updatedHook
);
}
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment