Skip to content

Commit aa97a89

Browse files
committed
New tests for integrations with other plugins
This test is written so that we can test cloudbees-folder plugin.
1 parent b6a807e commit aa97a89

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
package org.jenkinsci.plugins.gogs;
2+
3+
import com.cloudbees.hudson.plugins.folder.Folder;
4+
import hudson.model.FreeStyleProject;
5+
import hudson.model.Job;
6+
import org.junit.Rule;
7+
import org.junit.Test;
8+
import org.jvnet.hudson.test.JenkinsRule;
9+
import org.slf4j.Logger;
10+
import org.slf4j.LoggerFactory;
11+
12+
import java.io.IOException;
13+
14+
import static org.junit.Assert.assertEquals;
15+
16+
/*
17+
* Class to test gogs webhook in cooperation with other plugins
18+
*/
19+
public class GogsWebHookPluginsTest {
20+
private final String FOLDERNAME = "testFolder";
21+
private final String PROJECTNAME = "testProject";
22+
23+
final Logger log = LoggerFactory.getLogger(GogsWebHookPluginsTest.class);
24+
25+
@Rule
26+
public JenkinsRule r = new JenkinsRule();
27+
28+
@Test
29+
public void testCloudBeesFolder() throws Exception {
30+
Folder folder = createFolder(FOLDERNAME);
31+
32+
FreeStyleProject project = folder.createProject(FreeStyleProject.class, PROJECTNAME);
33+
34+
Job job = GogsUtils.find(FOLDERNAME + "/" + PROJECTNAME, Job.class);
35+
assertEquals("Couldn't find " + FOLDERNAME + "/" + PROJECTNAME, job, project);
36+
}
37+
38+
//
39+
// Helper methods
40+
//
41+
private Folder createFolder(String folder) throws IOException {
42+
return r.jenkins.createProject(Folder.class, folder);
43+
}
44+
45+
}

0 commit comments

Comments
 (0)