Whisper sync feature

Now KOReader supports more sync options, and most of the sync operation can be
executed automatically.
This commit is contained in:
Hzj_jie
2016-09-24 01:20:28 -07:00
committed by Zijie He
parent 0ba2417e24
commit fd7ae875c0
3 changed files with 378 additions and 140 deletions

View File

@@ -173,4 +173,40 @@ describe("KOSync modules #notest #nocov", function()
DEBUG("Please retry later", res)
end
end)
-- The response of mockKOSyncClient
local res = {
result = false,
body = {}
}
-- TODO: Test kosync module
local function mockKOSyncClient()
package.loaded["KOSyncClient"] = nil
local c = require("KOSyncClient")
c.new = function(o)
local o = o or {}
setmetatable(o, self)
self.__index = self
return o
end
c.init = function() end
c.register = function(name, passwd)
return res.result, res.body
end
c.authorize = function(name, passwd)
return res.result, res.body
end
c.update_progress = function(name, passwd, doc, prog, percent, device, device_id, cb)
cb(res.result, res.body)
end
c.get_progress = function(name, passwd, doc, cb)
cb(res.result, res.body)
end
end
end)