tests.eventstreams_tests module#
Tests for the eventstreams module.
- class tests.eventstreams_tests.EventStreamsTestClass(**kwargs)[source]#
Bases:
EventStreams
Test class of EventStreams.
- Keyword Arguments:
site (APISite) – a project site object. Used if no url is given
since (Timestamp or str) – a timestamp for older events; there will likely be between 7 and 31 days of history available but is not guaranteed. It may be given as a pywikibot.Timestamp, an ISO 8601 string or a mediawiki timestamp string.
streams (Iterable[str] or str) – event stream types. Mandatory when no url is given. Multiple streams may be given as a string with comma separated stream types or an iterable of strings
timeout (int or float or Tuple[int or float, int or float]) – a timeout value indication how long to wait to send data before giving up
url (str) – an url retrieving events from. Will be set up to a default url using _site.family settings, stream types and timestamp
- Parameters:
kwargs – keyword arguments passed to
SSEClient
andrequests
library- Raises:
ImportError – sseclient is not installed
NotImplementedError – no stream types specified
See also
https://stream.wikimedia.org/?doc#streams for available Wikimedia stream types to be passed with
streams
parameter.
- class tests.eventstreams_tests.TestEventSource(*args, **kwargs)[source]#
Bases:
DisableSiteMixin
,TestCase
Test sseclient.EventSource.
- abstract_class = False#
- net = True#
- class tests.eventstreams_tests.TestEventStreamsFilter(*args, **kwargs)[source]#
Bases:
DisableSiteMixin
,TestCase
Filter tests for eventstreams module.
- abstract_class = False#
- data = {'bar': 'baz', 'foo': True}#
- dry = True#
- class tests.eventstreams_tests.TestEventStreamsSettingTests(*args, **kwargs)[source]#
Bases:
DisableSiteMixin
,TestCase
Setting tests for eventstreams module.
- abstract_class = False#
- dry = True#
- class tests.eventstreams_tests.TestEventStreamsStreamsTests(*args, **kwargs)[source]#
Bases:
CheckHostnameMixin
,DefaultSiteTestCase
Stream tests for eventstreams module.
- abstract_class = False#
- code = 'test'#
- family = 'wikipedia'#
- net = True#
- site = True#
- sites = {'wikipedia:test': {'code': 'test', 'family': 'wikipedia'}}#
- class tests.eventstreams_tests.TestEventStreamsUrlTests(*args, **kwargs)[source]#
Bases:
CheckHostnameMixin
,TestCase
Url tests for eventstreams module.
- abstract_class = False#
- net = True#
- site = True#
- sites = {'de-wp': {'code': 'de', 'family': 'wikipedia', 'hostname': 'de.wikipedia.org'}, 'en-wq': {'code': 'en', 'family': 'wikiquote', 'hostname': 'en.wikiquote.org'}}#
- test_url_from_site_de_wp()#
Test EventStreams with url from site on wikipedia:de
- test_url_from_site_en_wq()#
Test EventStreams with url from site on wikiquote:en
- test_url_parameter_de_wp()#
Test EventStreams with given url on wikipedia:de
- test_url_parameter_en_wq()#
Test EventStreams with given url on wikiquote:en