Index: tests/mollom.test
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/mollom/tests/mollom.test,v
retrieving revision 1.61
diff -u -p -r1.61 mollom.test
--- tests/mollom.test	20 Sep 2010 03:39:10 -0000	1.61
+++ tests/mollom.test	21 Sep 2010 19:20:39 -0000
@@ -136,16 +136,17 @@ class MollomWebTestCase extends DrupalWe
    *
    * This function can be (repeatedly) invoked to assert new watchdog messages.
    * All watchdog messages with a higher severity than WATCHDOG_NOTICE are
-   * considered as fails.
+   * considered as failures.
    *
-   * @param $no_fail_expected
-   *   (optional) Boolean whether a failing watchdog message is expected.
-   *   Defaults to TRUE (no fail expected). If FALSE is passed, the logic for
-   *   assertion messages is flipped.
+   * @param $positive
+   *   (optional) Boolean whether only positive, informational (non-severe)
+   *   watchdog messages are expected. Defaults to TRUE (no severe messages are
+   *   expected). If FALSE, all messages will pass, but there must have been at
+   *   least one severe message.
    *
-   * @todo Add this to D7 core.
+   * @todo Add this to Drupal core.
    */
-  protected function assertMollomWatchdogMessages($no_fail_expected = TRUE) {
+  protected function assertMollomWatchdogMessages($positive = TRUE) {
     module_load_include('inc', 'dblog', 'dblog.admin');
 
     $this->messages = array();
@@ -153,6 +154,8 @@ class MollomWebTestCase extends DrupalWe
       ->fields('w')
       ->condition('w.type', 'mollom')
       ->orderBy('w.timestamp', 'ASC');
+
+    $had_severe_message = FALSE;
     foreach ($query->execute() as $row) {
       // In case no fail is expected, only log messages with a severity of
       // WATCHDOG_NOTICE or less severe messages must pass. More severe messages
@@ -162,15 +165,21 @@ class MollomWebTestCase extends DrupalWe
       // WATCHDOG_EMERGENCY is 0, WATCHDOG_NOTICE is 5, WATCHDOG_DEBUG is 7.
       // In case a fail is expected, all messages always pass, since we would
       // otherwise trigger a false positive test failure if there are additional
-      // non-severe log messages.
-      if (!$no_fail_expected || $row->severity >= WATCHDOG_NOTICE) {
+      // non-severe log messages. However, in order to actually assert the
+      // expectation, there must have been at least one severe log message.
+      if (!$positive || $row->severity >= WATCHDOG_NOTICE) {
         $this->pass(theme_dblog_message(array('event' => $row, 'link' => FALSE)), t('Watchdog'));
+        $had_severe_message = ($had_severe_message || $row->severity < WATCHDOG_NOTICE);
       }
       else {
         $this->fail(theme_dblog_message(array('event' => $row, 'link' => FALSE)), t('Watchdog'));
       }
       $this->messages[$row->wid] = $row;
     }
+    // In case we expected a severe message, there must have been one.
+    if (!$positive && !$had_severe_message) {
+      $this->fail(t('Severe log message not found.'), t('Watchdog'));
+    }
     // Delete processed watchdog messages.
     if (!empty($this->messages)) {
       $seen_ids = array_keys($this->messages);
@@ -790,7 +799,8 @@ class MollomInstallationTestCase extends
       'mollom_public_key' => 'foo',
       'mollom_private_key' => 'bar',
     );
-    $this->drupalPost('admin/config/content/mollom/settings', $edit, t('Save configuration'), array('watchdog' => FALSE));
+    $this->drupalGet('admin/config/content/mollom/settings');
+    $this->drupalPost(NULL, $edit, t('Save configuration'), array('watchdog' => FALSE));
     $this->assertText(t('The configuration options have been saved.'));
     $this->assertNoText($this->fallback_message, t('Fallback message not found.'));
 
