Test fixes after 5bceebf56c

This commit is contained in:
Dan Stillman 2016-11-29 03:52:07 -05:00
parent 8799bb4ebd
commit 8f0ed56ae2
5 changed files with 11 additions and 12 deletions

View file

@ -40,7 +40,6 @@ Zotero.Sync.Storage.Local = {
case 'user':
case 'publications':
case 'feed':
Zotero.debug("Storage Mode: " + Zotero.Prefs.get("sync.storage.protocol"));
return Zotero.Prefs.get("sync.storage.protocol") == 'webdav' ? 'webdav' : 'zfs';
case 'group':

View file

@ -936,7 +936,7 @@ Zotero.Sync.Data.Engine.prototype._uploadObjects = Zotero.Promise.coroutine(func
objectType,
o.id,
{
// Only storage properties ('mtime', 'md5') for WebDAV files
// Only include storage properties ('mtime', 'md5') for WebDAV files
skipStorageProperties:
objectType == 'item'
? Zotero.Sync.Storage.Local.getModeForLibrary(this.library.libraryID)

View file

@ -198,6 +198,7 @@ mocha.setup({
before(function () {
// Store all prefs set in runtests.sh
Components.utils.import("resource://zotero/config.js");
var prefBranch = Services.prefs.getBranch(ZOTERO_CONFIG.PREF_BRANCH);
ZoteroUnit.customPrefs = {};
prefBranch.getChildList("", {})
@ -209,6 +210,7 @@ before(function () {
* Clear all prefs, and reset those set in runtests.sh to original values
*/
function resetPrefs() {
Components.utils.import("resource://zotero/config.js");
var prefBranch = Services.prefs.getBranch(ZOTERO_CONFIG.PREF_BRANCH);
prefBranch.getChildList("", {}).forEach(key => {
var origVal = ZoteroUnit.customPrefs[key];

View file

@ -829,7 +829,7 @@ describe("Zotero.Sync.Data.Engine", function () {
})
it("shouldn't include storage properties for attachments in ZFS libraries", function* () {
it("shouldn't include mtime and md5 for attachments in ZFS libraries", function* () {
({ engine, client, caller } = yield setup());
var library = Zotero.Libraries.userLibrary;
@ -938,13 +938,14 @@ describe("Zotero.Sync.Data.Engine", function () {
});
it("should upload synced storage properties", function* () {
it("should include mtime and md5 synced to WebDAV in WebDAV libraries", function* () {
({ engine, client, caller } = yield setup());
var library = Zotero.Libraries.userLibrary;
var lastLibraryVersion = 2;
library.libraryVersion = lastLibraryVersion;
yield library.saveTx();
Zotero.Sync.Storage.Local.setModeForLibrary(library.id, 'webdav');
var item = new Zotero.Item('attachment');
item.attachmentLinkMode = 'imported_file';

View file

@ -54,14 +54,6 @@ describe("Zotero.Sync.Storage.Mode.WebDAV", function () {
assert.equal(request.requestHeaders["Zotero-API-Key"], apiKey);
}
before(function* () {
controller = new Zotero.Sync.Storage.Mode.WebDAV;
Zotero.Prefs.set("sync.storage.scheme", davScheme);
Zotero.Prefs.set("sync.storage.url", davHostPath);
Zotero.Prefs.set("sync.storage.username", davUsername);
controller.password = davPassword;
})
beforeEach(function* () {
yield resetDB({
thisArg: this,
@ -79,6 +71,11 @@ describe("Zotero.Sync.Storage.Mode.WebDAV", function () {
yield Zotero.Users.setCurrentUsername("testuser");
Zotero.Sync.Storage.Local.setModeForLibrary(Zotero.Libraries.userLibraryID, 'webdav');
controller = new Zotero.Sync.Storage.Mode.WebDAV;
Zotero.Prefs.set("sync.storage.scheme", davScheme);
Zotero.Prefs.set("sync.storage.url", davHostPath);
Zotero.Prefs.set("sync.storage.username", davUsername);
controller.password = davPassword;
// Set download-on-sync by default
Zotero.Sync.Storage.Local.downloadOnSync(