Index: sunmailer.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/sunmailer/sunmailer.module,v
retrieving revision 1.1.2.47
diff -u -p -r1.1.2.47 sunmailer.module
--- sunmailer.module	11 Apr 2010 23:52:52 -0000	1.1.2.47
+++ sunmailer.module	28 Apr 2010 22:28:17 -0000
@@ -638,7 +638,7 @@ function sunmailer_subscribe_form_submit
       }
     }
     if (!count($sids) && !count($role_sids)) {
-      $sids = array_keys($edit['sunmailer_sections']);
+      $sids = array_keys(sunmailer_get_sections());
     }
   }
   if (isset($edit['roles'])) {
Index: sunmailer.test
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/sunmailer/sunmailer.test,v
retrieving revision 1.1.2.25
diff -u -p -r1.1.2.25 sunmailer.test
--- sunmailer.test	11 Apr 2010 21:53:21 -0000	1.1.2.25
+++ sunmailer.test	28 Apr 2010 22:28:18 -0000
@@ -781,16 +781,25 @@ class SunMailerUserTestCase extends SunM
    * Tests the newsletter subscription form.
    */
   public function testSubscribeForm() {
+    // First test a user without any role subscriptions.
+    $user = $this->drupalCreateUser();
+    $user_edit = "user/{$user->uid}/edit/sunmailer";
+    $this->drupalLogin($user);
+    // Subscribe/unsubscribe with a single section.
     $sections = array(
       array('name' => 'Section 1', 'view' => 'blah'),
+    );
+    $this->createNewsletterSections($sections);
+    $this->drupalPost($user_edit, array('sunmailer_format' => 1), 'Save');
+    $this->assertSubscription($user->uid, array(1), 1);
+    $this->drupalPost($user_edit, array('sunmailer_format' => 0), 'Save');
+    $this->assertSubscription($user->uid, array(), 0);
+    // Add two new sections.
+    $sections = array(
       array('name' => 'Section 2', 'view' => 'blah'),
       array('name' => 'Section 3', 'view' => 'blah'),
     );
     $this->createNewsletterSections($sections);
-    // First test a user without any role subscriptions.
-    $user = $this->drupalCreateUser();
-    $user_edit = "user/{$user->uid}/edit/sunmailer";
-    $this->drupalLogin($user);
     // Subscribe to all sections.
     $this->drupalPost($user_edit, array('sunmailer_format' => 1), 'Save');
     $this->assertSunmailerDBConstraints();
