Store API key in login manager, and add temp field in prefs

This commit is contained in:
Dan Stillman 2015-11-02 03:22:37 -05:00
parent e03cf637b6
commit d07756d68d
6 changed files with 167 additions and 65 deletions

View file

@ -1,6 +1,25 @@
"use strict";
describe("Zotero.Sync.Data.Local", function() {
describe("#getAPIKey()/#setAPIKey()", function () {
it("should get and set an API key", function* () {
var apiKey1 = Zotero.Utilities.randomString(24);
var apiKey2 = Zotero.Utilities.randomString(24);
Zotero.Sync.Data.Local.setAPIKey(apiKey1);
assert.equal(Zotero.Sync.Data.Local.getAPIKey(apiKey1), apiKey1);
Zotero.Sync.Data.Local.setAPIKey(apiKey2);
assert.equal(Zotero.Sync.Data.Local.getAPIKey(apiKey2), apiKey2);
})
it("should clear an API key by setting an empty string", function* () {
var apiKey = Zotero.Utilities.randomString(24);
Zotero.Sync.Data.Local.setAPIKey(apiKey);
Zotero.Sync.Data.Local.setAPIKey("");
assert.strictEqual(Zotero.Sync.Data.Local.getAPIKey(apiKey), "");
})
})
describe("#processSyncCacheForObjectType()", function () {
var types = Zotero.DataObjectUtilities.getTypes();