services/sync/tests/tps/test_passwords.js

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

mercurial