Skip to content
Permalink
Browse files

Fix JENKINS-20133

Made sure the field names and the parsing code matched. Added tests.
  • Loading branch information...
slide committed Oct 21, 2013
1 parent 56de14b commit 311e53b411b1bca139bce60e75be0aa935362786
@@ -370,7 +370,7 @@ public boolean configure(StaplerRequest req, JSONObject formData)

// specify List-ID information
if (req.hasParameter("ext_mailer_use_list_id")) {
listId = nullify(req.getParameter("ext_mailer_listid"));
listId = nullify(req.getParameter("ext_mailer_list_id"));
} else {
listId = null;
}
@@ -52,7 +52,7 @@ f.section(title: _("Extended E-mail Notification")) {
input(type: "text", class: "setting-input", value: descriptor.listId, name: "ext_mailer_list_id")
}
}
f.optionalBlock(help: "/plugin/email-ext/help/globalConfig/precedenceBulk.html", checked: descriptor.precedenceBulk, name: "ext_mailer_add_precendence_bulk", title: _("Add 'Precedence: bulk' Email Header"))
f.optionalBlock(help: "/plugin/email-ext/help/globalConfig/precedenceBulk.html", checked: descriptor.precedenceBulk, name: "ext_mailer_add_precedence_bulk", title: _("Add 'Precedence: bulk' Email Header"))
f.entry(field: "recipients", help: "/plugin/email-ext/help/globalConfig/defaultRecipients.html", title: _("Default Recipients")) {
input(type: "text", class: "setting-input", value: descriptor.defaultRecipients, name: "ext_mailer_default_recipients")
}
@@ -39,7 +39,7 @@ public void testGlobalConfigDefaultState() throws Exception {
assertNotNull("Use List ID should be present", useListId);
assertFalse("Use List ID should not be checked by default", useListId.isChecked());

HtmlCheckBoxInput precedenceBulk = page.getElementByName("ext_mailer_add_precendence_bulk");
HtmlCheckBoxInput precedenceBulk = page.getElementByName("ext_mailer_add_precedence_bulk");
assertNotNull("Precedence Bulk should be present", precedenceBulk);
assertFalse("Add precedence bulk should not be checked by default",
precedenceBulk.isChecked());
@@ -101,4 +101,31 @@ public void testGlobalConfigSimpleRoundTrip() throws Exception {

assertEquals("mickey@disney.com", descriptor.getDefaultRecipients());
}

@Test
@Bug(20133)
public void testPrecedenceBulkSettingRoundTrip() throws Exception {
ExtendedEmailPublisherDescriptor descriptor = j.jenkins.getDescriptorByType(ExtendedEmailPublisherDescriptor.class);
HtmlPage page = j.createWebClient().goTo("configure");
HtmlCheckBoxInput addPrecedenceBulk = page.getElementByName("ext_mailer_add_precedence_bulk");
addPrecedenceBulk.setChecked(true);
j.submit(page.getFormByName("config"));

assertEquals(true, descriptor.getPrecedenceBulk());
}

@Test
@Bug(20133)
public void testListIDRoundTrip() throws Exception {
ExtendedEmailPublisherDescriptor descriptor = j.jenkins.getDescriptorByType(ExtendedEmailPublisherDescriptor.class);
HtmlPage page = j.createWebClient().goTo("configure");
HtmlCheckBoxInput useListId = page.getElementByName("ext_mailer_use_list_id");
useListId.setChecked(true);
HtmlTextInput listId = page.getElementByName("ext_mailer_list_id");
listId.setValueAttribute("hammer");

j.submit(page.getFormByName("config"));

assertEquals("hammer", descriptor.getListId());
}
}

0 comments on commit 311e53b

Please sign in to comment.
You can’t perform that action at this time.