Trivial formatting
This commit is contained in:
@@ -7,9 +7,10 @@ import signal
|
|||||||
import atexit
|
import atexit
|
||||||
import sys
|
import sys
|
||||||
from functools import partial
|
from functools import partial
|
||||||
|
from slixmpp.xmlstream.matcher.base import MatcherBase
|
||||||
|
|
||||||
|
|
||||||
class MatchAll(slixmpp.xmlstream.matcher.base.MatcherBase):
|
class MatchAll(MatcherBase):
|
||||||
"""match everything"""
|
"""match everything"""
|
||||||
|
|
||||||
def match(self, xml):
|
def match(self, xml):
|
||||||
@@ -80,11 +81,13 @@ class XMPPComponent(slixmpp.BaseXMPP):
|
|||||||
self.accepting_server = yield from self.loop.create_server(lambda: self,
|
self.accepting_server = yield from self.loop.create_server(lambda: self,
|
||||||
"127.0.0.1", "8811", reuse_address=True)
|
"127.0.0.1", "8811", reuse_address=True)
|
||||||
|
|
||||||
|
|
||||||
def check_xpath(xpath, stanza):
|
def check_xpath(xpath, stanza):
|
||||||
matched = slixmpp.xmlstream.matcher.xpath.MatchXPath(xpath).match(stanza)
|
matched = slixmpp.xmlstream.matcher.xpath.MatchXPath(xpath).match(stanza)
|
||||||
if not matched:
|
if not matched:
|
||||||
raise StanzaError("Received stanza “%s” did not match expected xpath “%s”" % (stanza, self.expected_xpath))
|
raise StanzaError("Received stanza “%s” did not match expected xpath “%s”" % (stanza, self.expected_xpath))
|
||||||
|
|
||||||
|
|
||||||
class Scenario:
|
class Scenario:
|
||||||
"""Defines a list of actions that are executed in sequence, until one of
|
"""Defines a list of actions that are executed in sequence, until one of
|
||||||
them throws an exception, or until the end. An action can be something
|
them throws an exception, or until the end. An action can be something
|
||||||
@@ -107,7 +110,9 @@ class BiboumiRunner:
|
|||||||
self.name = name
|
self.name = name
|
||||||
self.fd = open("biboumi_%s_output.txt" % (name,), "w")
|
self.fd = open("biboumi_%s_output.txt" % (name,), "w")
|
||||||
if with_valgrind:
|
if with_valgrind:
|
||||||
self.create = asyncio.create_subprocess_exec("valgrind", "--leak-check=full", "--show-leak-kinds=all", "--errors-for-leak-kinds=all", "--error-exitcode=16", "./biboumi", "test.conf", stdin=None, stdout=self.fd,
|
self.create = asyncio.create_subprocess_exec("valgrind", "--leak-check=full", "--show-leak-kinds=all",
|
||||||
|
"--errors-for-leak-kinds=all", "--error-exitcode=16",
|
||||||
|
"./biboumi", "test.conf", stdin=None, stdout=self.fd,
|
||||||
stderr=self.fd, loop=None, limit=None)
|
stderr=self.fd, loop=None, limit=None)
|
||||||
else:
|
else:
|
||||||
self.create = asyncio.create_subprocess_exec("./biboumi", "test.conf", stdin=None, stdout=self.fd,
|
self.create = asyncio.create_subprocess_exec("./biboumi", "test.conf", stdin=None, stdout=self.fd,
|
||||||
@@ -190,6 +195,7 @@ class BiboumiTest:
|
|||||||
|
|
||||||
return not failed
|
return not failed
|
||||||
|
|
||||||
|
|
||||||
confs = {'basic':
|
confs = {'basic':
|
||||||
"""hostname=biboumi.localhost
|
"""hostname=biboumi.localhost
|
||||||
password=coucou
|
password=coucou
|
||||||
@@ -212,7 +218,8 @@ if __name__ == '__main__':
|
|||||||
[
|
[
|
||||||
partial(expect_stanza, "{jabber:component:accept}handshake"),
|
partial(expect_stanza, "{jabber:component:accept}handshake"),
|
||||||
partial(send_stanza, "<handshake xmlns='jabber:component:accept'/>"),
|
partial(send_stanza, "<handshake xmlns='jabber:component:accept'/>"),
|
||||||
partial(send_stanza, "<presence from='me@example.com/Nick' to='#foo%irc.localhost@biboumi.localhost' />"),
|
partial(send_stanza,
|
||||||
|
"<presence from='me@example.com/Nick' to='#foo%irc.localhost@biboumi.localhost' />"),
|
||||||
partial(expect_stanza, "{jabber:component:accept}message/body"),
|
partial(expect_stanza, "{jabber:component:accept}message/body"),
|
||||||
]),
|
]),
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user