Make tests work

This commit is contained in:
Girish Ramakrishnan
2017-09-27 10:25:36 -07:00
parent 8d3fbc5432
commit e39329218d
8 changed files with 63 additions and 27 deletions

View File

@@ -25,8 +25,6 @@ var assert = require('assert'),
safe = require('safetydance'),
shell = require('../shell.js');
var BACKUP_USER = config.TEST ? process.env.USER : 'yellowtent';
// storage api
function upload(apiConfig, backupFilePath, sourceStream, callback) {
assert.strictEqual(typeof apiConfig, 'object');
@@ -34,6 +32,9 @@ function upload(apiConfig, backupFilePath, sourceStream, callback) {
assert.strictEqual(typeof sourceStream, 'object');
assert.strictEqual(typeof callback, 'function');
// in test, upload() may or may not be called via sudo script
const BACKUP_USER = config.TEST ? (process.env.SUDO_USER || process.env.USER) : 'yellowtent';
mkdirp(path.dirname(backupFilePath), function (error) {
if (error) return callback(new BackupsError(BackupsError.EXTERNAL_ERROR, error.message));