summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/com/gitblit/tests/GroovyScriptTest.java28
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/com/gitblit/tests/GroovyScriptTest.java b/tests/com/gitblit/tests/GroovyScriptTest.java
index 3d3621df..47d20a4c 100644
--- a/tests/com/gitblit/tests/GroovyScriptTest.java
+++ b/tests/com/gitblit/tests/GroovyScriptTest.java
@@ -70,6 +70,31 @@ public class GroovyScriptTest {
}
@Test
+ public void testSendHtmlMail() throws Exception {
+ MockGitblit gitblit = new MockGitblit();
+ MockLogger logger = new MockLogger();
+ MockClientLogger clientLogger = new MockClientLogger();
+ List<ReceiveCommand> commands = new ArrayList<ReceiveCommand>();
+ commands.add(new ReceiveCommand(ObjectId
+ .fromString("c18877690322dfc6ae3e37bb7f7085a24e94e887"), ObjectId
+ .fromString("3fa7c46d11b11d61f1cbadc6888be5d0eae21969"), "refs/heads/master"));
+ commands.add(new ReceiveCommand(ObjectId
+ .fromString("c18877690322dfc6ae3e37bb7f7085a24e94e887"), ObjectId
+ .fromString("3fa7c46d11b11d61f1cbadc6888be5d0eae21969"), "refs/heads/master2"));
+
+ RepositoryModel repository = GitBlit.self().getRepositoryModel("helloworld.git");
+ repository.mailingLists.add("list@helloworld.git");
+
+ test("sendmail-html.groovy", gitblit, logger, clientLogger, commands, repository);
+ assertEquals(1, logger.messages.size());
+ assertEquals(1, gitblit.messages.size());
+ MockMail m = gitblit.messages.get(0);
+ assertEquals(5, m.toAddresses.size());
+ assertTrue(m.message.contains("BIT"));
+ assertTrue(m.message.contains("<html>"));
+ }
+
+ @Test
public void testSendMail() throws Exception {
MockGitblit gitblit = new MockGitblit();
MockLogger logger = new MockLogger();
@@ -296,6 +321,9 @@ public class GroovyScriptTest {
public void sendMail(String subject, String message, Collection<String> toAddresses) {
messages.add(new MockMail(subject, message, toAddresses));
}
+ public void sendHtmlMail(String subject, String message, Collection<String> toAddresses) {
+ messages.add(new MockMail(subject, message, toAddresses));
+ }
}
class MockLogger {