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
560b7f32
Commit
560b7f32
authored
Jul 08, 2019
by
Greg Messner
Browse files
Added tests for MattermostService (#401).
parent
064b9151
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/test/java/org/gitlab4j/api/TestServicesApi.java
View file @
560b7f32
...
@@ -9,6 +9,7 @@ import static org.junit.Assume.assumeNotNull;
...
@@ -9,6 +9,7 @@ import static org.junit.Assume.assumeNotNull;
import
org.gitlab4j.api.models.Project
;
import
org.gitlab4j.api.models.Project
;
import
org.gitlab4j.api.services.ExternalWikiService
;
import
org.gitlab4j.api.services.ExternalWikiService
;
import
org.gitlab4j.api.services.JiraService
;
import
org.gitlab4j.api.services.JiraService
;
import
org.gitlab4j.api.services.MattermostService
;
import
org.gitlab4j.api.services.SlackService
;
import
org.gitlab4j.api.services.SlackService
;
import
org.junit.Before
;
import
org.junit.Before
;
import
org.junit.BeforeClass
;
import
org.junit.BeforeClass
;
...
@@ -188,4 +189,41 @@ public class TestServicesApi extends AbstractIntegrationTest {
...
@@ -188,4 +189,41 @@ public class TestServicesApi extends AbstractIntegrationTest {
assertNotNull
(
deleteExternalWikiService
);
assertNotNull
(
deleteExternalWikiService
);
assertFalse
(
deleteExternalWikiService
.
getActive
());
assertFalse
(
deleteExternalWikiService
.
getActive
());
}
}
@Test
public
void
testGetMattermostService
()
throws
GitLabApiException
{
MattermostService
service
=
gitLabApi
.
getServicesApi
().
getMattermostService
(
testProject
);
assertNotNull
(
service
);
}
@Test
public
void
testUpdateMattermostService
()
throws
GitLabApiException
{
try
{
MattermostService
service
=
new
MattermostService
()
.
withMergeRequestsEvents
(
true
)
.
withWebhook
(
"https://hooks.mattermost.com/services/ABCDEFGHI/KJLMNOPQR/wetrewq7897HKLH8998wfjjj"
)
.
withUsername
(
"GitLab4J"
);
MattermostService
updatedService
=
gitLabApi
.
getServicesApi
().
updateMattermostService
(
testProject
,
service
);
assertNotNull
(
updatedService
);
}
finally
{
try
{
gitLabApi
.
getServicesApi
().
deleteMattermostService
(
testProject
);
}
catch
(
Exception
ignore
)
{}
}
}
@Test
public
void
testDeleteMattermostService
()
throws
GitLabApiException
{
MattermostService
service
=
new
MattermostService
()
.
withMergeRequestsEvents
(
true
)
.
withWebhook
(
"https://hooks.mattermost.com/services/ABCDEFGHI/KJLMNOPQR/wetrewq7897HKLH8998wfjjj"
)
.
withUsername
(
"GitLab4J"
);
MattermostService
updatedService
=
gitLabApi
.
getServicesApi
().
updateMattermostService
(
testProject
,
service
);
assertNotNull
(
updatedService
);
assertTrue
(
updatedService
.
getActive
());
gitLabApi
.
getServicesApi
().
deleteMattermostService
(
testProject
);
MattermostService
deleteMattermostService
=
gitLabApi
.
getServicesApi
().
getMattermostService
(
testProject
);
assertNotNull
(
deleteMattermostService
);
assertFalse
(
deleteMattermostService
.
getActive
());
}
}
}
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