ibid.test – Ibid Testing¶
End-to-end testing¶
-
class
ibid.test.PluginTestCase¶ A subclass of Twisted Trial’s unittest.TestCase. It sets up an environment much like a running Ibid including a clean SQLite database, and loads the specified plugins,
-
load¶ List: strings naming plugins to be loaded before running tests.
Default: empty
-
noload¶ List: strings naming plugins not to be loaded.
Default: empty
-
load_base¶ Boolean: whether to load a small set of base plugins (currently, just core).
Default:
True
-
load_configured¶ Boolean: load all configured modules (excluding
noload).Default: if
loadis empty,True; otherwise,False.
-
username¶ String: the default username/nick in events created by the
make_event()method.Default:
u'user'
-
public¶ Boolean: whether or not the events created by
make_event()are public.Default:
False
-
network¶ Boolean: whether or not the test uses the external network. Used to skip tests in networkless environments (where the environment variable
IBID_NETWORKLESS_TESTis defined).Default:
False
-
setUp()¶ If you override this method, make sure you call
PluginTestCase.setUp().
-
tearDown()¶ If you override this method, make sure you call
PluginTestCase.tearDown().
-
make_event(message=None, type=u'message')¶ Create and return an event on the test source, from the test user, of type type.
-
responseMatches(event, regex)¶ Process event (either an event or a string to be treated as a message from the test user on the test source), and return a 3-tuple of (result, event, responses); result is a bool indicating whether the response matches regex (either a regex string or a compiled regex).
The other two elements give more information: event is the processed event; responses is a single matching response if result is
True, or a list of all responses otherwise.
-
assertResponseMatches(event, regex)¶ Assert that
responseMatches()returns true.
-
failIfResponseMatches(event, regex)¶ The opposite of
assertResponseMatches().
-
assertSucceeds(event)¶ Process event (either an event or a string to be treated as a message from the test user on the test source), and check that it is processed by some
Processorand no complaint is set.
-
assertFails(event)¶ The opposite of
assertSucceeds().
-