diff options
author | Guillaume Sauthier <guillaume.sauthier@peergreen.com> | 2012-11-05 11:30:06 -0500 |
---|---|---|
committer | James Moger <james.moger@gitblit.com> | 2012-11-05 11:30:06 -0500 |
commit | d60a425fbe5d67732d4e2b5275d496c47c36b474 (patch) | |
tree | 9b8f81ddeefb3e92f3e717440d2456ed71d24b19 /tests | |
parent | 377ba9888f0a061667d10ede54782d3b0faf529f (diff) | |
download | gitblit-d60a425fbe5d67732d4e2b5275d496c47c36b474.tar.gz gitblit-d60a425fbe5d67732d4e2b5275d496c47c36b474.zip |
HTML email notification methods and hook (pull request #51)
Diffstat (limited to 'tests')
-rw-r--r-- | tests/com/gitblit/tests/GroovyScriptTest.java | 28 |
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 {
|