aboutsummaryrefslogtreecommitdiffstats
path: root/spec/scansion
diff options
context:
space:
mode:
Diffstat (limited to 'spec/scansion')
-rw-r--r--spec/scansion/lastactivity.scs45
-rw-r--r--spec/scansion/prosody.cfg.lua14
-rw-r--r--spec/scansion/uptime.scs21
-rw-r--r--spec/scansion/version.scs27
4 files changed, 107 insertions, 0 deletions
diff --git a/spec/scansion/lastactivity.scs b/spec/scansion/lastactivity.scs
new file mode 100644
index 00000000..44f4e516
--- /dev/null
+++ b/spec/scansion/lastactivity.scs
@@ -0,0 +1,45 @@
+# XEP-0012: Last Activity / mod_lastactivity
+
+[Client] Romeo
+ jid: romeo@localhost
+ password: password
+
+-----
+
+Romeo connects
+
+Romeo sends:
+ <presence>
+ <status>Hello</status>
+ </presence>
+
+Romeo receives:
+ <presence from="${Romeo's full JID}">
+ <status>Hello</status>
+ </presence>
+
+Romeo sends:
+ <presence type="unavailable">
+ <status>Goodbye</status>
+ </presence>
+
+Romeo receives:
+ <presence from="${Romeo's full JID}" type="unavailable">
+ <status>Goodbye</status>
+ </presence>
+
+# mod_lastlog saves time + status message from the last unavailable presence
+
+Romeo sends:
+ <iq id='a' type='get'>
+ <query xmlns='jabber:iq:last'/>
+ </iq>
+
+Romeo receives:
+ <iq type='result' id='a'>
+ <query xmlns='jabber:iq:last' seconds='0'>Goodbye</query>
+ </iq>
+
+Romeo disconnects
+
+# recording ended on 2020-04-20T14:39:47Z
diff --git a/spec/scansion/prosody.cfg.lua b/spec/scansion/prosody.cfg.lua
index 6a72584d..b7d6ccd5 100644
--- a/spec/scansion/prosody.cfg.lua
+++ b/spec/scansion/prosody.cfg.lua
@@ -1,5 +1,16 @@
--luacheck: ignore
+-- Mock time functions to simplify tests
+function _G.os.time()
+ return 1219439344;
+end
+package.preload["util.time"] = function ()
+ return {
+ now = function () return 1219439344.1; end;
+ monotonic = function () return 0.1; end;
+ }
+end
+
admins = { "admin@localhost" }
use_libevent = true
@@ -48,6 +59,7 @@ modules_enabled = {
--"motd"; -- Send a message to users when they log in
--"legacyauth"; -- Legacy authentication. Only used by some old clients and bots.
--"proxy65"; -- Enables a file transfer proxy service which clients behind NAT can use
+ "lastactivity";
-- Useful for testing
--"scansion_record"; -- Records things that happen in scansion test case format
@@ -84,6 +96,8 @@ pidfile = "prosody.pid"
VirtualHost "localhost"
+hide_os_type = true -- absense tested for in version.scs
+
Component "conference.localhost" "muc"
storage = "memory"
diff --git a/spec/scansion/uptime.scs b/spec/scansion/uptime.scs
new file mode 100644
index 00000000..188b9eb5
--- /dev/null
+++ b/spec/scansion/uptime.scs
@@ -0,0 +1,21 @@
+# XEP-0012: Last Activity / mod_uptime
+
+[Client] Romeo
+ jid: romeo@localhost
+ password: password
+
+-----
+
+Romeo connects
+
+Romeo sends:
+ <iq id='a' type='get' to='localhost'>
+ <query xmlns='jabber:iq:last'/>
+ </iq>
+
+Romeo receives:
+ <iq type='result' id='a' from='localhost'>
+ <query xmlns='jabber:iq:last' seconds='0'/>
+ </iq>
+
+Romeo disconnects
diff --git a/spec/scansion/version.scs b/spec/scansion/version.scs
new file mode 100644
index 00000000..6c841dd9
--- /dev/null
+++ b/spec/scansion/version.scs
@@ -0,0 +1,27 @@
+# XEP-0092: Software Version / mod_version
+
+[Client] Romeo
+ password: password
+ jid: romeo@localhost/dfaZpuxV
+
+-----
+
+Romeo connects
+
+Romeo sends:
+ <iq id='lx2' to='localhost' type='get'>
+ <query xmlns='jabber:iq:version'/>
+ </iq>
+
+# Version string would vary so we can't do an exact match atm
+# Inclusion of <os/> is disabled in the config, it should be absent
+Romeo receives:
+ <iq id='lx2' from='localhost' type='result'>
+ <query xmlns='jabber:iq:version' scansion:strict='true'>
+ <name>Prosody</name>
+ <version scansion:strict='false'/>
+ </query>
+ </iq>
+
+
+Romeo disconnects