#98, test sync impl

This commit is contained in:
azivner
2018-07-23 10:29:17 +02:00
parent e7460ca3a9
commit a06618d851
6 changed files with 43 additions and 2 deletions

View File

@@ -35,7 +35,7 @@ async function setupSyncFromServer(req) {
auth: username + ':' + password
};
log.info("Getting document from: " + serverAddress + JSON.stringify(options));
log.info("Getting document from: " + serverAddress);
http.request(options, function(response) {
response.pipe(file);

View File

@@ -9,6 +9,20 @@ const contentHashService = require('../../services/content_hash');
const log = require('../../services/log');
const DOCUMENT_PATH = require('../../services/data_dir').DOCUMENT_PATH;
async function testSync() {
try {
await syncService.login();
return { connection: "Success" };
}
catch (e) {
return {
connection: "Failure",
error: e.message
};
}
}
async function checkSync() {
return {
hashes: await contentHashService.getHashes(),
@@ -80,6 +94,7 @@ async function getDocument(req, resp) {
}
module.exports = {
testSync,
checkSync,
syncNow,
fillSyncRows,