diff options
author | Kim Alvefur <zash@zash.se> | 2023-12-17 16:29:03 +0100 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2023-12-17 16:29:03 +0100 |
commit | 30f791386bf8ea375648bf13b7b2171a0f219941 (patch) | |
tree | 6c8313826d288b77a475c75d7b3645d1f74a02c7 | |
parent | 251f4d3c8a72494586887eb701f181fe0bc94f18 (diff) | |
download | prosody-30f791386bf8ea375648bf13b7b2171a0f219941.tar.gz prosody-30f791386bf8ea375648bf13b7b2171a0f219941.zip |
scansion: Use captures or wildcards instead of mocking time
> Mockery is one of the things I hold dear! And he's making a mockery of it!!
-- Belkar Bitterleaf
-rw-r--r-- | spec/scansion/extdisco.scs | 8 | ||||
-rw-r--r-- | spec/scansion/lastactivity.scs | 2 | ||||
-rw-r--r-- | spec/scansion/mam_extended.scs | 16 | ||||
-rw-r--r-- | spec/scansion/prosody.cfg.lua | 10 | ||||
-rw-r--r-- | spec/scansion/uptime.scs | 2 |
5 files changed, 14 insertions, 24 deletions
diff --git a/spec/scansion/extdisco.scs b/spec/scansion/extdisco.scs index f0781dc5..f2c8139f 100644 --- a/spec/scansion/extdisco.scs +++ b/spec/scansion/extdisco.scs @@ -17,8 +17,8 @@ Romeo receives: <iq type='result' id='lx2' from='localhost'> <services xmlns='urn:xmpp:extdisco:2'> <service host='default.example' transport='udp' port='9876' type='stun'/> - <service port='9876' type='turn' restricted='1' password='yHYYBDN7M3mdlug0LTdJbW0GvvQ=' transport='udp' host='default.example' username='1219525744'/> - <service port='9876' type='turn' restricted='1' password='1Uc6QfrDhIlbK97rGCUQ/cUICxs=' transport='udp' host='default.example' username='1219525744'/> + <service port='9876' type='turn' restricted='1' password='{scansion:any}' transport='udp' host='default.example' username='{scansion:any}'/> + <service port='9876' type='turn' restricted='1' password='{scansion:any}' transport='udp' host='default.example' username='{scansion:any}'/> <service port='2121' type='ftp' restricted='1' password='password' transport='tcp' host='default.example' username='john'/> <service port='21' type='ftp' restricted='1' password='password' transport='tcp' host='ftp.example.com' username='john'/> </services> @@ -47,8 +47,8 @@ Romeo sends: Romeo receives: <iq type='result' id='lx4' from='localhost'> <credentials xmlns='urn:xmpp:extdisco:2'> - <service port='9876' type='turn' restricted='1' password='yHYYBDN7M3mdlug0LTdJbW0GvvQ=' transport='udp' host='default.example' username='1219525744'/> - <service port='9876' type='turn' restricted='1' password='1Uc6QfrDhIlbK97rGCUQ/cUICxs=' transport='udp' host='default.example' username='1219525744'/> + <service port='9876' type='turn' restricted='1' password='{scansion:any}' transport='udp' host='default.example' username='{scansion:any}'/> + <service port='9876' type='turn' restricted='1' password='{scansion:any}' transport='udp' host='default.example' username='{scansion:any}'/> </credentials> </iq> diff --git a/spec/scansion/lastactivity.scs b/spec/scansion/lastactivity.scs index 44f4e516..4b8c8573 100644 --- a/spec/scansion/lastactivity.scs +++ b/spec/scansion/lastactivity.scs @@ -37,7 +37,7 @@ Romeo sends: Romeo receives: <iq type='result' id='a'> - <query xmlns='jabber:iq:last' seconds='0'>Goodbye</query> + <query xmlns='jabber:iq:last' seconds='{scansion:any}'>Goodbye</query> </iq> Romeo disconnects diff --git a/spec/scansion/mam_extended.scs b/spec/scansion/mam_extended.scs index 70897737..e79eba95 100644 --- a/spec/scansion/mam_extended.scs +++ b/spec/scansion/mam_extended.scs @@ -45,8 +45,8 @@ Romeo sends: Romeo receives: <iq type="result" id="mamextmeta"> <metadata xmlns="urn:xmpp:mam:2"> - <start timestamp="2008-08-22T21:09:04.500000Z" xmlns="urn:xmpp:mam:2" id="{scansion:any}"/> - <end timestamp="2008-08-22T21:09:04.500000Z" xmlns="urn:xmpp:mam:2" id="{scansion:any}"/> + <start timestamp="{scansion:capture:start}" xmlns="urn:xmpp:mam:2" id="{scansion:capture:first}"/> + <end timestamp="{scansion:capture:end}" xmlns="urn:xmpp:mam:2" id="{scansion:capture:last}"/> </metadata> </iq> @@ -57,9 +57,9 @@ Romeo sends: Romeo receives: <message to="${Romeo's full JID}"> - <result xmlns="urn:xmpp:mam:2" queryid="q1" id="{scansion:any}"> + <result xmlns="urn:xmpp:mam:2" queryid="q1" id="{scansion:capture:first}"> <forwarded xmlns="urn:xmpp:forward:0"> - <delay stamp="2008-08-22T21:09:04.500000Z" xmlns="urn:xmpp:delay"/> + <delay stamp="{scansion:capture:start}" xmlns="urn:xmpp:delay"/> <message to="someone@localhost" xmlns="jabber:client" type="chat" xml:lang="en" id="chat01" from="${Romeo's full JID}"> <body>Hello</body> </message> @@ -69,9 +69,9 @@ Romeo receives: Romeo receives: <message to="${Romeo's full JID}"> - <result xmlns="urn:xmpp:mam:2" queryid="q1" id="{scansion:any}"> + <result xmlns="urn:xmpp:mam:2" queryid="q1" id="{scansion:capture:last}"> <forwarded xmlns="urn:xmpp:forward:0"> - <delay stamp="2008-08-22T21:09:04.500000Z" xmlns="urn:xmpp:delay"/> + <delay stamp="{scansion:capture:end}" xmlns="urn:xmpp:delay"/> <message to="someone@localhost" xmlns="jabber:client" type="chat" xml:lang="en" id="chat02" from="${Romeo's full JID}"> <body>U there?</body> </message> @@ -98,7 +98,7 @@ Romeo receives: <message to="${Romeo's full JID}"> <result xmlns="urn:xmpp:mam:2" queryid="q1" id="{scansion:any}"> <forwarded xmlns="urn:xmpp:forward:0"> - <delay stamp="2008-08-22T21:09:04.500000Z" xmlns="urn:xmpp:delay"/> + <delay stamp="{scansion:capture:start}" xmlns="urn:xmpp:delay"/> <message to="someone@localhost" xmlns="jabber:client" type="chat" xml:lang="en" id="chat02" from="${Romeo's full JID}"> <body>U there?</body> </message> @@ -110,7 +110,7 @@ Romeo receives: <message to="${Romeo's full JID}"> <result xmlns="urn:xmpp:mam:2" queryid="q1" id="{scansion:any}"> <forwarded xmlns="urn:xmpp:forward:0"> - <delay stamp="2008-08-22T21:09:04.500000Z" xmlns="urn:xmpp:delay"/> + <delay stamp="{scansion:capture:end}" xmlns="urn:xmpp:delay"/> <message to="someone@localhost" xmlns="jabber:client" type="chat" xml:lang="en" id="chat01" from="${Romeo's full JID}"> <body>Hello</body> </message> diff --git a/spec/scansion/prosody.cfg.lua b/spec/scansion/prosody.cfg.lua index 0061635d..f090296a 100644 --- a/spec/scansion/prosody.cfg.lua +++ b/spec/scansion/prosody.cfg.lua @@ -1,15 +1,5 @@ --luacheck: ignore --- Mock time functions to simplify tests -- -local time = require "util.time"; -function _G.os.time() - return 1219439344; -end -function time.now() - return 1219439344.5; -end -------------------------------------------- - admins = { "admin@localhost" } network_backend = ENV_PROSODY_NETWORK_BACKEND or "epoll" diff --git a/spec/scansion/uptime.scs b/spec/scansion/uptime.scs index 188b9eb5..ed83e51b 100644 --- a/spec/scansion/uptime.scs +++ b/spec/scansion/uptime.scs @@ -15,7 +15,7 @@ Romeo sends: Romeo receives: <iq type='result' id='a' from='localhost'> - <query xmlns='jabber:iq:last' seconds='0'/> + <query xmlns='jabber:iq:last' seconds='{scansion:any}'/> </iq> Romeo disconnects |