services/sync/tests/tps/test_passwords.js

Wed, 31 Dec 2014 07:53:36 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 07:53:36 +0100
branch
TOR_BUG_3246
changeset 5
4ab42b5ab56c
permissions
-rw-r--r--

Correct small whitespace inconsistency, lost while renaming variables.

michael@0 1 /* Any copyright is dedicated to the Public Domain.
michael@0 2 http://creativecommons.org/publicdomain/zero/1.0/ */
michael@0 3
michael@0 4 /*
michael@0 5 * The list of phases mapped to their corresponding profiles. The object
michael@0 6 * here must be in strict JSON format, as it will get parsed by the Python
michael@0 7 * testrunner (no single quotes, extra comma's, etc).
michael@0 8 */
michael@0 9 EnableEngines(["passwords"]);
michael@0 10
michael@0 11 var phases = { "phase1": "profile1",
michael@0 12 "phase2": "profile2",
michael@0 13 "phase3": "profile1",
michael@0 14 "phase4": "profile2" };
michael@0 15
michael@0 16 /*
michael@0 17 * Password asset lists: these define password entries that are used during
michael@0 18 * the test
michael@0 19 */
michael@0 20
michael@0 21 // initial password list to be loaded into the browser
michael@0 22 var passwords_initial = [
michael@0 23 { hostname: "http://www.example.com",
michael@0 24 submitURL: "http://login.example.com",
michael@0 25 username: "joe",
michael@0 26 password: "SeCrEt123",
michael@0 27 usernameField: "uname",
michael@0 28 passwordField: "pword",
michael@0 29 changes: {
michael@0 30 password: "zippity-do-dah"
michael@0 31 }
michael@0 32 },
michael@0 33 { hostname: "http://www.example.com",
michael@0 34 realm: "login",
michael@0 35 username: "joe",
michael@0 36 password: "secretlogin"
michael@0 37 }
michael@0 38 ];
michael@0 39
michael@0 40 // expected state of passwords after the changes in the above list are applied
michael@0 41 var passwords_after_first_update = [
michael@0 42 { hostname: "http://www.example.com",
michael@0 43 submitURL: "http://login.example.com",
michael@0 44 username: "joe",
michael@0 45 password: "zippity-do-dah",
michael@0 46 usernameField: "uname",
michael@0 47 passwordField: "pword"
michael@0 48 },
michael@0 49 { hostname: "http://www.example.com",
michael@0 50 realm: "login",
michael@0 51 username: "joe",
michael@0 52 password: "secretlogin"
michael@0 53 }
michael@0 54 ];
michael@0 55
michael@0 56 var passwords_to_delete = [
michael@0 57 { hostname: "http://www.example.com",
michael@0 58 realm: "login",
michael@0 59 username: "joe",
michael@0 60 password: "secretlogin"
michael@0 61 }
michael@0 62 ];
michael@0 63
michael@0 64 var passwords_absent = [
michael@0 65 { hostname: "http://www.example.com",
michael@0 66 realm: "login",
michael@0 67 username: "joe",
michael@0 68 password: "secretlogin"
michael@0 69 }
michael@0 70 ];
michael@0 71
michael@0 72 // expected state of passwords after the delete operation
michael@0 73 var passwords_after_second_update = [
michael@0 74 { hostname: "http://www.example.com",
michael@0 75 submitURL: "http://login.example.com",
michael@0 76 username: "joe",
michael@0 77 password: "zippity-do-dah",
michael@0 78 usernameField: "uname",
michael@0 79 passwordField: "pword"
michael@0 80 }
michael@0 81 ];
michael@0 82
michael@0 83 /*
michael@0 84 * Test phases
michael@0 85 */
michael@0 86
michael@0 87 Phase('phase1', [
michael@0 88 [Passwords.add, passwords_initial],
michael@0 89 [Sync]
michael@0 90 ]);
michael@0 91
michael@0 92 Phase('phase2', [
michael@0 93 [Sync],
michael@0 94 [Passwords.verify, passwords_initial],
michael@0 95 [Passwords.modify, passwords_initial],
michael@0 96 [Passwords.verify, passwords_after_first_update],
michael@0 97 [Sync]
michael@0 98 ]);
michael@0 99
michael@0 100 Phase('phase3', [
michael@0 101 [Sync],
michael@0 102 [Passwords.verify, passwords_after_first_update],
michael@0 103 [Passwords.delete, passwords_to_delete],
michael@0 104 [Passwords.verify, passwords_after_second_update],
michael@0 105 [Passwords.verifyNot, passwords_absent],
michael@0 106 [Sync]
michael@0 107 ]);
michael@0 108
michael@0 109 Phase('phase4', [
michael@0 110 [Sync],
michael@0 111 [Passwords.verify, passwords_after_second_update],
michael@0 112 [Passwords.verifyNot, passwords_absent]
michael@0 113 ]);

mercurial