diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /services/sync/tests/unit/test_service_checkAccount.js | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'services/sync/tests/unit/test_service_checkAccount.js')
-rw-r--r-- | services/sync/tests/unit/test_service_checkAccount.js | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/services/sync/tests/unit/test_service_checkAccount.js b/services/sync/tests/unit/test_service_checkAccount.js new file mode 100644 index 000000000..618348d1a --- /dev/null +++ b/services/sync/tests/unit/test_service_checkAccount.js @@ -0,0 +1,41 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ */ + +Cu.import("resource://services-sync/service.js"); +Cu.import("resource://services-sync/util.js"); +Cu.import("resource://testing-common/services/sync/utils.js"); + +function run_test() { + do_test_pending(); + ensureLegacyIdentityManager(); + let server = httpd_setup({ + "/user/1.0/johndoe": httpd_handler(200, "OK", "1"), + "/user/1.0/janedoe": httpd_handler(200, "OK", "0"), + // john@doe.com + "/user/1.0/7wohs32cngzuqt466q3ge7indszva4of": httpd_handler(200, "OK", "0"), + // jane@doe.com + "/user/1.0/vuuf3eqgloxpxmzph27f5a6ve7gzlrms": httpd_handler(200, "OK", "1") + }); + try { + Service.serverURL = server.baseURI; + + _("A 404 will be recorded as 'generic-server-error'"); + do_check_eq(Service.checkAccount("jimdoe"), "generic-server-error"); + + _("Account that's available."); + do_check_eq(Service.checkAccount("john@doe.com"), "available"); + + _("Account that's not available."); + do_check_eq(Service.checkAccount("jane@doe.com"), "notAvailable"); + + _("Username fallback: Account that's not available."); + do_check_eq(Service.checkAccount("johndoe"), "notAvailable"); + + _("Username fallback: Account that's available."); + do_check_eq(Service.checkAccount("janedoe"), "available"); + + } finally { + Svc.Prefs.resetBranch(""); + server.stop(do_test_finished); + } +} |