Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
biboumi
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
99
Issues
99
List
Boards
Labels
Service Desk
Milestones
Merge Requests
12
Merge Requests
12
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
louiz’
biboumi
Commits
45f442b6
Commit
45f442b6
authored
Apr 17, 2016
by
louiz’
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
More tests
parent
e0ee881f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
60 additions
and
7 deletions
+60
-7
tests/end_to_end/__main__.py
tests/end_to_end/__main__.py
+59
-6
tests/end_to_end/mammond.conf
tests/end_to_end/mammond.conf
+1
-1
No files found.
tests/end_to_end/__main__.py
View file @
45f442b6
...
...
@@ -87,6 +87,7 @@ class XMPPComponent(slixmpp.BaseXMPP):
def
check_stanza_against_all_expected_xpaths
(
self
):
pass
def
check_xpath
(
xpaths
,
stanza
):
for
xpath
in
xpaths
:
tree
=
lxml
.
etree
.
parse
(
io
.
StringIO
(
str
(
stanza
)))
...
...
@@ -118,6 +119,7 @@ class Scenario:
else
:
self
.
steps
.
append
(
elem
)
class
ProcessRunner
:
def
__init__
(
self
):
self
.
process
=
None
...
...
@@ -155,13 +157,14 @@ class BiboumiRunner(ProcessRunner):
self
.
create
=
asyncio
.
create_subprocess_exec
(
"./biboumi"
,
"test.conf"
,
stdin
=
None
,
stdout
=
self
.
fd
,
stderr
=
self
.
fd
,
loop
=
None
,
limit
=
None
)
class
IrcServerRunner
(
ProcessRunner
):
def
__init__
(
self
):
super
().
__init__
()
self
.
create
=
asyncio
.
create_subprocess_exec
(
"mammond"
,
"--debug"
,
"--nofork"
,
"--config"
,
"../tests/end_to_end/mammond.conf"
,
self
.
create
=
asyncio
.
create_subprocess_exec
(
"/home/louiz/sources/charybdis/ircd/charybdis"
,
"-foreground"
,
stderr
=
asyncio
.
subprocess
.
PIPE
)
def
send_stanza
(
stanza
,
xmpp
,
biboumi
):
xmpp
.
send_raw
(
stanza
.
format_map
(
common_replacements
))
asyncio
.
get_event_loop
().
call_soon
(
xmpp
.
run_scenario
)
...
...
@@ -175,6 +178,7 @@ def expect_stanza(xpaths, xmpp, biboumi):
else
:
print
(
"Warning, from argument type passed to expect_stanza: %s"
%
(
type
(
xpaths
)))
class
BiboumiTest
:
"""
Spawns a biboumi process and a fake XMPP Component that will run a
...
...
@@ -330,20 +334,69 @@ if __name__ == '__main__':
# Second user joins
partial
(
send_stanza
,
"<presence from='{jid_two}/{resource_one}' to='#foo%{irc_server_one}/{nick_two}' />"
),
connection_sequence
(
"irc.localhost"
,
'{jid_two}/{resource_one}'
),
# Our presence, sent to the other user
partial
(
expect_stanza
,
(
"/presence[@to='{jid_one}/{resource_one}'][@from='#foo%{irc_server_one}/{nick_two}']/muc_user:x/muc_user:item[@affiliation='none'][@jid='~bobby@localhost'][@role='participant']"
,)),
# The other user presence
partial
(
expect_stanza
,
(
"/presence[@to='{jid_second}/{resource_one}'][@from='#foo%{irc_server_one}/{nick_one}']/muc_user:x/muc_user:item[@affiliation='none'][@jid='~nick@localhost'][@role='participant']"
)
),
# Our own presence
partial
(
expect_stanza
,
(
"/presence[@to='{jid_two}/{resource_one}'][@from='#foo%{irc_server_one}/{nick_two}']/muc_user:x/muc_user:item[@affiliation='none'][@jid='~bobby@localhost'][@role='participant']"
,
"/presence/muc_user:x/muc_user:status[@code='110']"
)
),
partial
(
expect_stanza
,
"/message[@from='#foo%{irc_server_one}'][@type='groupchat']/subject[not(text())]"
),
]),
Scenario
(
"channel_custom_topic"
,
[
handshake_sequence
(),
# First user joins
partial
(
send_stanza
,
"<presence from='{jid_one}/{resource_one}' to='#foo%{irc_server_one}/{nick_one}' />"
),
connection_sequence
(
"irc.localhost"
,
'{jid_one}/{resource_one}'
),
partial
(
expect_stanza
,
(
"/presence[@to='{jid_one}/{resource_one}'][@from='#foo%{irc_server_one}/{nick_one}']/muc_user:x/muc_user:item[@affiliation='none'][@jid='~nick@localhost'][@role='participant']"
,
"/presence/muc_user:x/muc_user:status[@code='110']"
)
),
partial
(
expect_stanza
,
"/message[@from='#foo%{irc_server_one}'][@type='groupchat']/subject[not(text())]"
),
# First user sets the topic
partial
(
send_stanza
,
"<message from='{jid_one}/{resource_one}' to='#foo%{irc_server_one}/{nick_one}' type='groupchat'><subject>TOPIC
\n
TEST</subject></message>"
),
partial
(
expect_stanza
,
"/message[@from='#foo%{irc_server_one}/{nick_one}'][@type='groupchat'][@to='{jid_one}/{resource_one}']/subject[text()='TOPIC
\n
TEST']"
),
# # Second user joins
# partial(send_stanza,
# "<presence from='{jid_two}/{resource_one}' to='#foo%{irc_server_one}/{nick_two}' />"),
# connection_sequence("irc.localhost", '{jid_two}/{resource_one}'),
# # Our presence, sent to the other user
# partial(expect_stanza,
# ("/presence[@to='{jid_one}/{resource_one}'][@from='#foo%{irc_server_one}/{nick_two}']/muc_user:x/muc_user:item[@affiliation='none'][@jid='~bobby@localhost'][@role='participant']",)),
# # The other user presence
# partial(expect_stanza,
# ("/presence[@to='{jid_second}/{resource_one}'][@from='#foo%{irc_server_one}/{nick_one}']/muc_user:x/muc_user:item[@affiliation='none'][@jid='~nick@localhost'][@role='participant']")
# ),
# # Our own presence
# partial(expect_stanza,
# ("/presence[@to='{jid_two}/{resource_one}'][@from='#foo%{irc_server_one}/{nick_two}']/muc_user:x/muc_user:item[@affiliation='none'][@jid='~bobby@localhost'][@role='participant']",
# "/presence/muc_user:x/muc_user:status[@code='110']")
# ),
# partial(expect_stanza, "/message[@from='#foo%{irc_server_one}'][@type='groupchat']/subject[not(text())]"),
]),
)
failures
=
0
irc
=
IrcServerRunner
()
print
(
"Starting
mammond
server…"
)
print
(
"Starting
irc
server…"
)
asyncio
.
get_event_loop
().
run_until_complete
(
irc
.
start
())
while
True
:
res
=
asyncio
.
get_event_loop
().
run_until_complete
(
irc
.
process
.
stderr
.
readline
())
if
b
"
init finished...
"
in
res
:
if
b
"
now running in foreground mode
"
in
res
:
break
print
(
"
mammond
server started."
)
print
(
"
irc
server started."
)
print
(
"Running %s checks for biboumi."
%
(
len
(
scenarios
)))
for
scenario
in
scenarios
:
...
...
@@ -353,7 +406,7 @@ if __name__ == '__main__':
(
scenario
.
name
,
scenario
.
name
))
failures
+=
1
print
(
"Waiting for
mammond
to exit…"
)
print
(
"Waiting for
irc server
to exit…"
)
irc
.
stop
()
code
=
asyncio
.
get_event_loop
().
run_until_complete
(
irc
.
wait
())
...
...
tests/end_to_end/mammond.conf
View file @
45f442b6
...
...
@@ -233,7 +233,7 @@ opers:
# name - the name of the operator
"nobody"
:
# password - the plaintext oper password
password
:
"nothing"
#
password: "nothing"
# hostmask - if defined, the hostmask the oper must connect from
hostmask
:
"*@localhost"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment