Commit graph

26 commits

Author SHA1 Message Date
mathieui
768089d457 tests: fix bogus test case
stanza.match worked accidentally, but the two elements used in that test
actually conflict with each other (not overriding the plugin_attrib,
which makes it then default to 'plugin', leading to shenanigans).
2021-04-19 19:42:52 +02:00
Emmanuel Gil Peyrot
cd4c9f82fc Remove OrderedDict usage
We now support only Python 3.7+, this means we can rely on dict being
ordered by order of insertion, and thus no need to use OrderedDict from
collections.
2020-12-06 17:00:47 +01:00
Florian Klien
d33366badd fixing deprecation warnings for pytest 2018-10-15 14:59:23 +02:00
Emmanuel Gil Peyrot
d008988843 Manual cleanup of the remaining set([…]) and set((…)). 2016-10-22 13:37:46 +01:00
Emmanuel Gil Peyrot
dcacc7d7d5 sed -i 's/set(\[\(.*\)\])$/{\1}/g' **/*.py 2016-10-22 13:21:44 +01:00
Emmanuel Gil Peyrot
c4285961df sed -i 's/set((\(.*\)))$/{\1}/g' **/*.py 2016-10-22 13:21:42 +01:00
Emmanuel Gil Peyrot
1038f656eb sed -i 's/set((\(.*\),))$/{\1}/g' **/*.py 2016-10-22 13:21:41 +01:00
mathieui
5da31db0c7 Fix stanza accessors case in tests
They were using deprecated (and-removed) style.
2016-10-04 21:15:01 +02:00
mathieui
acc52fd935
Merge branch 'develop' of https://github.com/fritzy/SleekXMPP into sleek-merge
Conflicts:
	README.rst
	examples/IoT_TestDevice.py
	examples/disco_browser.py
	setup.py
	sleekxmpp/jid.py
	sleekxmpp/plugins/google/auth/stanza.py
	sleekxmpp/plugins/google/gmail/notifications.py
	sleekxmpp/plugins/google/nosave/stanza.py
	sleekxmpp/plugins/google/settings/settings.py
	sleekxmpp/thirdparty/__init__.py
	sleekxmpp/thirdparty/socks.py
	sleekxmpp/thirdparty/statemachine.py
	sleekxmpp/util/__init__.py
	sleekxmpp/xmlstream/xmlstream.py
	slixmpp/basexmpp.py
	slixmpp/plugins/xep_0004/stanza/form.py
	slixmpp/plugins/xep_0009/rpc.py
	slixmpp/plugins/xep_0050/adhoc.py
	slixmpp/plugins/xep_0065/proxy.py
	slixmpp/plugins/xep_0084/stanza.py
	slixmpp/plugins/xep_0202/time.py
	slixmpp/plugins/xep_0323/sensordata.py
	slixmpp/plugins/xep_0325/control.py
	slixmpp/plugins/xep_0325/stanza/control.py
	slixmpp/roster/single.py
	slixmpp/stanza/atom.py
	slixmpp/stanza/rootstanza.py
	slixmpp/test/slixtest.py
	slixmpp/util/sasl/mechanisms.py
	slixmpp/version.py
	slixmpp/xmlstream/stanzabase.py
	tests/test_stanza_xep_0323.py
	tests/test_stanza_xep_0325.py
	tests/test_stream_xep_0323.py
	tests/test_stream_xep_0325.py
2015-10-02 19:00:19 +02:00
Emmanuel Gil Peyrot
7c3e61950d Remove all deprecated alias in the core of slixmpp, and wherever they were used. 2014-09-28 23:58:46 +02:00
Emmanuel Gil Peyrot
ed37174a2b Always use OrderedDict from collections, and remove its implementation in slixmpp.thirdparty. 2014-09-01 02:47:15 +02:00
Robin Gloster
afc939708f cleanup semicolons, whitespace and mutable default arguments 2014-08-23 12:47:29 +02:00
Robin Gloster
3dd379cdf1 Revert "cleanup semicolons, whitespace and mutable default arguments"
This reverts commit 7265682a4d.
2014-08-18 15:15:14 +02:00
Robin Gloster
7265682a4d cleanup semicolons, whitespace and mutable default arguments 2014-08-18 00:52:24 +02:00
Florent Le Coz
5ab77c7452 Rename to slixmpp 2014-07-17 14:19:04 +02:00
Jean-Philippe Caruana
18dde97c8c refactor: no import * in tests 2013-07-26 13:02:26 +02:00
Lance Stout
100e504b7f Resolve xml:lang issue with duplicated elements depending on ordering. 2012-06-22 18:19:17 -07:00
Lance Stout
181aea737d Add initial support for xml:lang for streams and stanza plugins.
Remaining items are suitable default actions for language supporting
interfaces.
2012-06-18 22:00:33 -07:00
Lance Stout
9e86a7b357 Tidy up and add tests for multi_attrib plugins. 2012-05-05 14:01:13 -07:00
Lance Stout
f1fde07eb9 Add tests for bool_interfaces. 2012-03-27 21:16:53 -07:00
Lance Stout
62e6d6fb4c Fix iterable substanzas when added as normal plugin.
If an iterable plugin was an enabled, it wasn't added to
the iterables list.
2011-12-11 17:04:58 -08:00
Lance Stout
6d45971411 Allow a stanza plugin to override a parent's interfaces.
Each interface, say foo, may be overridden in three ways:
    set_foo
    get_foo
    del_foo

To declare an override in a plugin, add the class field
overrides as so:
    overrides = ['set_foo', 'del_foo']

Each override must have a matching set_foo(), etc method
for implementing the new behaviour.

To enable the overrides for a particular parent stanza,
pass the option overrides=True to register_stanza_plugin.

    register_stanza_plugin(Stanza, Plugin, overrides=True)

Example code:

class Test(ElementBase):

    name = 'test'
    namespace = 'testing'
    interfaces = set(('foo', 'bar'))
    sub_interfaces = set(('bar',))

class TestOverride(ElementBase):

    name = 'test-override'
    namespace = 'testing'
    plugin_attrib = 'override'
    interfaces = set(('foo',))
    overrides = ['set_foo']

    def setup(self, xml):
        # Don't include an XML element in the parent stanza
        # since we're adding just an attribute.
        # If adding a regular subelement, no need to do this.
        self.xml = ET.Element('')

    def set_foo(self, value):
        print("overrides!")
        self.parent()._set_attr('foo', 'override-%s' % value)

register_stanza_plugin(Test, TestOverride, overrides=True)

Example usage:
>>> t = TestStanza()
>>> t['foo'] = 'bar'
>>> t['foo']
'override-bar'
2011-03-24 12:25:17 -04:00
Lance Stout
d0c506f930 Simplified SleekTest.
* check_stanza does not require stanza_class parameter. Introspection!
* check_message, check_iq, and check_presence removed -- use check
  instead.
* stream_send_stanza, stream_send_message, stream_send_iq, and
  stream_send_presence removed -- use send instead.
* Use recv instead of recv_message, recv_presence, etc.
* check_jid instead of check_JID
* stream_start may accept multi=True to return a new SleekTest instance
  for testing multiple streams at once.
2010-11-05 21:18:48 -04:00
Lance Stout
4375ac7d8b Underscore names by default.
Stanza objects now accept the use of underscored names.

The CamelCase versions are still available for backwards compatibility,
but are discouraged.

The property stanza.values now maps to the old getStanzaValues and
setStanzaValues, in addition to _set_stanza_values and
_get_stanza_values.
2010-10-17 22:04:42 -04:00
Lance Stout
e02ffe8547 Corrected test errors.
There was a bug in the XML compare method.
2010-10-07 19:42:28 -04:00
Lance Stout
0fffbb8200 Unit test reorganization.
Moved SleekTest to sleekxmpp.test.

Organized test suites by their focus.
- Suites focused on testing stanza objects are named test_stanza_X.py
- Suites focused on testing stream behavior are name test_stream_X.py
2010-10-07 10:58:13 -04:00
Renamed from tests/test_elementbase.py (Browse further)