11. Testing Mollom
To test a Mollom plug-in during development, Mollom allows a key to be put into `developer mode'. This 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. By doing this, 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 60 minutes 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; and if ham is passed, it will return `ham' with quality 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 developer mode, the mollom.verifyKey call can be tested using your own created developer key (this 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.