11. Testing Mollom

Note

The Mollom XML-RPC API interface has been deprecated, and is included here for archival purposes.

To develop clients and services that connect to Mollom, use the Mollom REST API.

To test a Mollom plug-in during development, the following options are provided:

  • Mollom allows an existing public/private key pair (i.e., a site) to be put into `developer mode', or
  • you can set the testing parameter to true in the request you wish to test.

There are subtle differences between the two methods. Enabling the key-wide `developer mode' can be done on the Mollom website by creating a key associated with a test site. After the key is created, follow the `edit site' link for the site you just created, and enable the `developer mode' checkbox. Using this feature, API calls using this key will be treated as test calls by Mollom. If an already existing site is put into developer mode, it can take as long as one hour or more for the changes to become effective.

When in `developer mode', the mollom.checkContent method can be forced to return certain values. A specific string passed in the POST body field defines what is returned. If the string spam is passed, the call will return `spam' with quality 0.0; if unsure is passed, it returns `unsure' with quality 0.5; if ham is passed, it will return `ham' with quality 1; and if profanity is passed, it will return `ham' with profanity 1; Mollom will also return valid session IDs that can be used for testing.

The mollom.checkCaptcha method can also be forced to return a specific response by setting the solution field. If the field is set to the string correct, the call will return true; when it is set to incorrect, false will be returned.

The calls for requesting a CAPTCHA mollom.getImageCaptcha and mollom.getAudioCaptcha will return valid CAPTCHA sessions and URLs. The correct/incorrect responses can be faked using the mollom.checkCaptcha test mode described above.

In testing mode, both the calls to mollom.checkContent and mollom.checkCaptcha can be forced to trigger an xmlrpc error with code 1100 or 1200 by passing refresh or redirect respectively.

In developer mode, the mollom.verifyKey call can be tested using your own created developer key (which will return true), a specifically created disabled key (which has a public key value of `disabled-key' and private key value of `disabled-key'), and a specific unknown key (which has a public key value of `unknown-key' and a private key value of `unknown-key'). The last two cases will return exceptions.