ponymail-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject [incubator-ponymail] branch master updated: Add basic mock functions
Date Fri, 19 Jul 2019 11:45:20 GMT
This is an automated email from the ASF dual-hosted git repository.

sebb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-ponymail.git


The following commit(s) were added to refs/heads/master by this push:
     new cdd277c  Add basic mock functions
cdd277c is described below

commit cdd277c257473e3fa937dd6e3db101bcfd12cb82
Author: Sebb <sebb@apache.org>
AuthorDate: Fri Jul 19 12:45:11 2019 +0100

    Add basic mock functions
---
 test/mock_r.lua | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git a/test/mock_r.lua b/test/mock_r.lua
new file mode 100644
index 0000000..7a2f96b
--- /dev/null
+++ b/test/mock_r.lua
@@ -0,0 +1,30 @@
+-- Mock version of various items for testing
+
+local _M = {}
+
+local r = {
+    puts = function(r, ...) print(...) end,
+    getcookie = function(r, name) return nil end,
+    strcmp_match = function(str, pat)
+                    pat = pat:gsub("%.", "%%."):gsub("*", ".+")
+                    return str:match(pat)
+                end,
+    ivm_set = function(r, key, val) _M['ivm_' .. key] = val end,
+    ivm_get = function(r, key) return _M['ivm_' .. key] end,
+}
+
+local function account(uid)
+    return {
+        credentials = {
+            uid = uid,
+        },                    
+        internal = {
+            oauth_used = 'localhost',
+        },
+    }
+end
+
+return {
+    r = r,
+    account = account
+}


Mime
View raw message