tests.bot_tests module#

Bot tests.

class tests.bot_tests.LiveBotTestCase(*args, **kwargs)[source]#

Bases: CheckHostnameMixin, TestBotTreatExit, DefaultSiteTestCase

Test bot classes which need to check the Page object live.

abstract_class = False#
code = 'test'#
family = 'wikipedia'#
net = True#
site = True#
sites = {'wikipedia:test': {'code': 'test', 'family': 'wikipedia'}}#
test_CreatingPageBot()[source]#

Test CreatingPageBot class.

test_ExistingPageBot()[source]#

Test ExistingPageBot class.

class tests.bot_tests.Options(**kwargs)[source]#

Bases: OptionHandler

A derived OptionHandler class.

Only accept options defined in available_options.

Parameters:

kwargs (Any) – bot options

available_options: Dict[str, Any] = {'bar': 42, 'baz': False, 'foo': 'bar'}#

Handler configuration attribute. Only the keys of the dict can be passed as __init__ options. The values are the default values. Overwrite this in subclasses!

class tests.bot_tests.TWNBotTestCase(*args, **kwargs)[source]#

Bases: TestCase

Verify that i18n is available.

abstract_class = True#
classmethod setUpClass()[source]#

Verify that the translations are available.

class tests.bot_tests.TestBotTreatExit[source]#

Bases: object

Mixin to provide handling for treat and exit.

class tests.bot_tests.TestDrySiteBot(*args, **kwargs)[source]#

Bases: DisconnectedSiteMixin, TestBotTreatExit, SiteAttributeTestCase

Tests for the BaseBot subclasses.

CANT_SET_ATTRIBUTE_RE = "can't set attribute"#
NOT_IN_TREAT_RE = 'Requesting the site not while in treat is not allowed.'#
abstract_class = False#
dry = True#
site = True#
sites = {'de': {'code': 'de', 'family': 'wikipedia'}, 'en': {'code': 'en', 'family': 'wikipedia'}}#
test_Bot()[source]#

Test normal Bot class.

test_Bot_KeyboardInterrupt()[source]#

Test normal Bot class with a KeyboardInterrupt in treat.

test_Bot_ValueError()[source]#

Test normal Bot class with a ValueError in treat.

test_CurrentPageBot()[source]#

Test normal Bot class.

test_MultipleSitesBot()[source]#

Test MultipleSitesBot class.

test_SingleSiteBot_automatic()[source]#

Test SingleSiteBot class with no predefined site.

test_SingleSiteBot_specific()[source]#

Test SingleSiteBot class with predefined site.

class tests.bot_tests.TestOptionHandler(*args, **kwargs)[source]#

Bases: DisableSiteMixin, TestCase

OptionHandler test class.

abstract_class = False#
dry = True#
setUp()[source]#

Setup tests.

test_opt_values()[source]#

Test OptionHandler.