Test fixes after 5bceebf56c
This commit is contained in:
parent
8799bb4ebd
commit
8f0ed56ae2
5 changed files with 11 additions and 12 deletions
|
@ -40,7 +40,6 @@ Zotero.Sync.Storage.Local = {
|
||||||
case 'user':
|
case 'user':
|
||||||
case 'publications':
|
case 'publications':
|
||||||
case 'feed':
|
case 'feed':
|
||||||
Zotero.debug("Storage Mode: " + Zotero.Prefs.get("sync.storage.protocol"));
|
|
||||||
return Zotero.Prefs.get("sync.storage.protocol") == 'webdav' ? 'webdav' : 'zfs';
|
return Zotero.Prefs.get("sync.storage.protocol") == 'webdav' ? 'webdav' : 'zfs';
|
||||||
|
|
||||||
case 'group':
|
case 'group':
|
||||||
|
|
|
@ -936,7 +936,7 @@ Zotero.Sync.Data.Engine.prototype._uploadObjects = Zotero.Promise.coroutine(func
|
||||||
objectType,
|
objectType,
|
||||||
o.id,
|
o.id,
|
||||||
{
|
{
|
||||||
// Only storage properties ('mtime', 'md5') for WebDAV files
|
// Only include storage properties ('mtime', 'md5') for WebDAV files
|
||||||
skipStorageProperties:
|
skipStorageProperties:
|
||||||
objectType == 'item'
|
objectType == 'item'
|
||||||
? Zotero.Sync.Storage.Local.getModeForLibrary(this.library.libraryID)
|
? Zotero.Sync.Storage.Local.getModeForLibrary(this.library.libraryID)
|
||||||
|
|
|
@ -198,6 +198,7 @@ mocha.setup({
|
||||||
|
|
||||||
before(function () {
|
before(function () {
|
||||||
// Store all prefs set in runtests.sh
|
// Store all prefs set in runtests.sh
|
||||||
|
Components.utils.import("resource://zotero/config.js");
|
||||||
var prefBranch = Services.prefs.getBranch(ZOTERO_CONFIG.PREF_BRANCH);
|
var prefBranch = Services.prefs.getBranch(ZOTERO_CONFIG.PREF_BRANCH);
|
||||||
ZoteroUnit.customPrefs = {};
|
ZoteroUnit.customPrefs = {};
|
||||||
prefBranch.getChildList("", {})
|
prefBranch.getChildList("", {})
|
||||||
|
@ -209,6 +210,7 @@ before(function () {
|
||||||
* Clear all prefs, and reset those set in runtests.sh to original values
|
* Clear all prefs, and reset those set in runtests.sh to original values
|
||||||
*/
|
*/
|
||||||
function resetPrefs() {
|
function resetPrefs() {
|
||||||
|
Components.utils.import("resource://zotero/config.js");
|
||||||
var prefBranch = Services.prefs.getBranch(ZOTERO_CONFIG.PREF_BRANCH);
|
var prefBranch = Services.prefs.getBranch(ZOTERO_CONFIG.PREF_BRANCH);
|
||||||
prefBranch.getChildList("", {}).forEach(key => {
|
prefBranch.getChildList("", {}).forEach(key => {
|
||||||
var origVal = ZoteroUnit.customPrefs[key];
|
var origVal = ZoteroUnit.customPrefs[key];
|
||||||
|
|
|
@ -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());
|
({ engine, client, caller } = yield setup());
|
||||||
|
|
||||||
var library = Zotero.Libraries.userLibrary;
|
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());
|
({ engine, client, caller } = yield setup());
|
||||||
|
|
||||||
var library = Zotero.Libraries.userLibrary;
|
var library = Zotero.Libraries.userLibrary;
|
||||||
var lastLibraryVersion = 2;
|
var lastLibraryVersion = 2;
|
||||||
library.libraryVersion = lastLibraryVersion;
|
library.libraryVersion = lastLibraryVersion;
|
||||||
yield library.saveTx();
|
yield library.saveTx();
|
||||||
|
Zotero.Sync.Storage.Local.setModeForLibrary(library.id, 'webdav');
|
||||||
|
|
||||||
var item = new Zotero.Item('attachment');
|
var item = new Zotero.Item('attachment');
|
||||||
item.attachmentLinkMode = 'imported_file';
|
item.attachmentLinkMode = 'imported_file';
|
||||||
|
|
|
@ -54,14 +54,6 @@ describe("Zotero.Sync.Storage.Mode.WebDAV", function () {
|
||||||
assert.equal(request.requestHeaders["Zotero-API-Key"], apiKey);
|
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* () {
|
beforeEach(function* () {
|
||||||
yield resetDB({
|
yield resetDB({
|
||||||
thisArg: this,
|
thisArg: this,
|
||||||
|
@ -79,6 +71,11 @@ describe("Zotero.Sync.Storage.Mode.WebDAV", function () {
|
||||||
yield Zotero.Users.setCurrentUsername("testuser");
|
yield Zotero.Users.setCurrentUsername("testuser");
|
||||||
|
|
||||||
Zotero.Sync.Storage.Local.setModeForLibrary(Zotero.Libraries.userLibraryID, 'webdav');
|
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
|
// Set download-on-sync by default
|
||||||
Zotero.Sync.Storage.Local.downloadOnSync(
|
Zotero.Sync.Storage.Local.downloadOnSync(
|
||||||
|
|
Loading…
Reference in a new issue