2012-03-22 15:49:50 -07:00
|
|
|
/* Any copyright is dedicated to the Public Domain.
|
|
|
|
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
|
|
|
|
2010-08-25 15:49:45 -07:00
|
|
|
Cu.import("resource://services-sync/constants.js");
|
|
|
|
Cu.import("resource://services-sync/identity.js");
|
|
|
|
Cu.import("resource://services-sync/status.js");
|
|
|
|
Cu.import("resource://services-sync/util.js");
|
|
|
|
|
|
|
|
function run_test() {
|
2012-03-22 15:49:50 -07:00
|
|
|
initTestLogging("Trace");
|
|
|
|
|
2010-08-25 15:49:45 -07:00
|
|
|
try {
|
2012-03-22 15:49:50 -07:00
|
|
|
_("Ensure fresh config.");
|
|
|
|
Identity.deleteSyncCredentials();
|
2010-08-25 15:49:45 -07:00
|
|
|
|
|
|
|
_("Fresh setup, we're not configured.");
|
|
|
|
do_check_eq(Status.checkSetup(), CLIENT_NOT_CONFIGURED);
|
|
|
|
do_check_eq(Status.login, LOGIN_FAILED_NO_USERNAME);
|
|
|
|
Status.resetSync();
|
|
|
|
|
|
|
|
_("Let's provide a username.");
|
2012-03-22 15:49:50 -07:00
|
|
|
Identity.username = "johndoe";
|
2010-08-25 15:49:45 -07:00
|
|
|
do_check_eq(Status.checkSetup(), CLIENT_NOT_CONFIGURED);
|
|
|
|
do_check_eq(Status.login, LOGIN_FAILED_NO_PASSWORD);
|
|
|
|
Status.resetSync();
|
|
|
|
|
2012-03-22 15:49:50 -07:00
|
|
|
do_check_neq(Identity.username, null);
|
2010-08-25 15:49:45 -07:00
|
|
|
|
|
|
|
_("Let's provide a password.");
|
2012-03-22 15:49:50 -07:00
|
|
|
Identity.basicPassword = "carotsalad";
|
2010-08-25 15:49:45 -07:00
|
|
|
do_check_eq(Status.checkSetup(), CLIENT_NOT_CONFIGURED);
|
|
|
|
do_check_eq(Status.login, LOGIN_FAILED_NO_PASSPHRASE);
|
|
|
|
Status.resetSync();
|
|
|
|
|
|
|
|
_("Let's provide a passphrase");
|
2012-03-22 15:49:50 -07:00
|
|
|
Identity.syncKey = "a-bcdef-abcde-acbde-acbde-acbde";
|
|
|
|
_("checkSetup()");
|
2010-08-25 15:49:45 -07:00
|
|
|
do_check_eq(Status.checkSetup(), STATUS_OK);
|
|
|
|
Status.resetSync();
|
|
|
|
|
|
|
|
} finally {
|
|
|
|
Svc.Prefs.resetBranch("");
|
|
|
|
}
|
|
|
|
}
|