Merge lp:~udt-contributors/mago/class-constants into lp:~mago-contributors/mago/mago-1.0
- class-constants
- Merge into mago-1.0
Proposed by
Javier Collado
Status: | Merged |
---|---|
Merged at revision: | not available |
Proposed branch: | lp:~udt-contributors/mago/class-constants |
Merge into: | lp:~mago-contributors/mago/mago-1.0 |
Diff against target: | None lines |
To merge this branch: | bzr merge lp:~udt-contributors/mago/class-constants |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Ara Pulido | Approve | ||
Javier Collado (community) | Approve | ||
Eitan Isaacson | Approve | ||
Review via email:
|
Commit message
Description of the change
To post a comment you must log in.
Revision history for this message
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Javier Collado (javier.collado) wrote : | # |
Revision history for this message
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Ara Pulido (ara) wrote : | # |
I did some minor changes to the branch (default window name and using some setters in the clean up method).
I will ask Eitan to also review this.
Cheers,
Ara.
Revision history for this message
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Eitan Isaacson (eeejay) wrote : | # |
This looks great. I like the idea.
One thing: You don't need to use __class__ to access class fields.
Instead of self.__
Revision history for this message
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Eitan Isaacson (eeejay) wrote : | # |
On Javier's approval I removed the __class__ prefix, script developers don't need to know/understand the distinction between class and instance variables, it will work as expected.
review:
Approve
Revision history for this message
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Javier Collado (javier.collado) : | # |
review:
Approve
Revision history for this message
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Ara Pulido (ara) : | # |
review:
Approve
- 62. By Eitan Isaacson
-
Comment out server.hide(), it is broken (bug #351537).
- 63. By Eitan Isaacson
-
Merge from trunk.
- 64. By Eitan Isaacson
-
Added a server display test.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'desktoptesting/gnome.py' | |||
2 | --- desktoptesting/gnome.py 2009-03-19 10:47:43 +0000 | |||
3 | +++ desktoptesting/gnome.py 2009-03-30 10:11:44 +0000 | |||
4 | @@ -5,23 +5,46 @@ | |||
5 | 5 | """ | 5 | """ |
6 | 6 | import ooldtp | 6 | import ooldtp |
7 | 7 | import ldtp | 7 | import ldtp |
8 | 8 | import gnome_constants | ||
9 | 9 | 8 | ||
10 | 10 | class Application: | 9 | class Application: |
11 | 11 | """ | 10 | """ |
13 | 12 | Supperclass for the rest of the applications | 11 | Superclass for the rest of the applications |
14 | 12 | |||
15 | 13 | Constants that should be defined in the classes that inherit from this class | ||
16 | 14 | LAUNCHER: Argument to be passed when launching the application through ldtp.launchapp | ||
17 | 15 | WINDOW: Top application frame pattern using ldtp syntax | ||
18 | 16 | CLOSE_TYPE: Close object type (one of 'menu' or 'button') | ||
19 | 17 | CLOSE_NAME: Close object name | ||
20 | 13 | """ | 18 | """ |
22 | 14 | def __init__(self, name = '', close_type='menu', close_name='mnuQuit'): | 19 | CLOSE_TYPE = 'menu' |
23 | 20 | CLOSE_NAME = 'mnuQuit' | ||
24 | 21 | |||
25 | 22 | TOP_PANEL = 'frmTopExpandedEdgePanel' | ||
26 | 23 | |||
27 | 24 | |||
28 | 25 | def __init__(self, name = None, close_type= None, close_name= None): | ||
29 | 15 | """ | 26 | """ |
30 | 16 | @type close_type: string | 27 | @type close_type: string |
31 | 17 | @param close_type: The type of close widget of the application. Types: menu, button. | 28 | @param close_type: The type of close widget of the application. Types: menu, button. |
32 | 18 | @type close_name: string | 29 | @type close_name: string |
34 | 19 | @param close_name: The name of the exit widget of the application. If not mentioned the default will be used ("Quit"). | 30 | @param close_name: The name of the exit widget of the application. If not mentioned the default will be used ("Quit") |
35 | 20 | """ | 31 | """ |
40 | 21 | self.name = name | 32 | if name: |
41 | 22 | self.close_type = close_type | 33 | self.name = name |
42 | 23 | self.close_name = close_name | 34 | else: |
43 | 24 | 35 | self.name = self.__class__.WINDOW | |
44 | 36 | |||
45 | 37 | if close_type: | ||
46 | 38 | self.close_type = close_type | ||
47 | 39 | else: | ||
48 | 40 | self.close_type = self.__class__.CLOSE_TYPE | ||
49 | 41 | |||
50 | 42 | if close_name: | ||
51 | 43 | self.close_name = close_name | ||
52 | 44 | else: | ||
53 | 45 | self.close_name = self.__class__.CLOSE_NAME | ||
54 | 46 | |||
55 | 47 | |||
56 | 25 | def setup(self): | 48 | def setup(self): |
57 | 26 | pass | 49 | pass |
58 | 27 | 50 | ||
59 | @@ -29,9 +52,9 @@ | |||
60 | 29 | pass | 52 | pass |
61 | 30 | 53 | ||
62 | 31 | def cleanup(self): | 54 | def cleanup(self): |
66 | 32 | self.set_name('') | 55 | self.name = self.__class__.WINDOW |
67 | 33 | self.set_close_type('menu') | 56 | self.close_type = self.__class__.CLOSE_TYPE |
68 | 34 | self.set_close_name('mnuQuit') | 57 | self.close_name = self.__class__.CLOSE_NAME |
69 | 35 | 58 | ||
70 | 36 | def recover(self): | 59 | def recover(self): |
71 | 37 | self.teardown() | 60 | self.teardown() |
72 | @@ -56,15 +79,14 @@ | |||
73 | 56 | """ | 79 | """ |
74 | 57 | ldtp.remap(self.name) | 80 | ldtp.remap(self.name) |
75 | 58 | 81 | ||
77 | 59 | def open_and_check_app(self, app_name): | 82 | def open_and_check_app(self): |
78 | 60 | """ | 83 | """ |
79 | 61 | Given an application, it tries to open it. | 84 | Given an application, it tries to open it. |
80 | 62 | 85 | ||
81 | 63 | @type app_name: string | 86 | @type app_name: string |
82 | 64 | @param app_name: The command to start the application. | 87 | @param app_name: The command to start the application. |
83 | 65 | """ | 88 | """ |
86 | 66 | 89 | ldtp.launchapp(self.__class__.LAUNCHER) | |
85 | 67 | ldtp.launchapp(app_name) | ||
87 | 68 | 90 | ||
88 | 69 | ldtp.wait(2) | 91 | ldtp.wait(2) |
89 | 70 | response = ldtp.waittillguiexist(self.name, '', 20) | 92 | response = ldtp.waittillguiexist(self.name, '', 20) |
90 | @@ -135,13 +157,40 @@ | |||
91 | 135 | except ldtp.LdtpExecutionError: | 157 | except ldtp.LdtpExecutionError: |
92 | 136 | raise ldtp.LdtpExecutionError, "We couldn't write text." | 158 | raise ldtp.LdtpExecutionError, "We couldn't write text." |
93 | 137 | 159 | ||
94 | 160 | |||
95 | 138 | class Seahorse(Application): | 161 | class Seahorse(Application): |
96 | 139 | """ | 162 | """ |
97 | 140 | Seahorse manages the Seahorse application. | 163 | Seahorse manages the Seahorse application. |
98 | 141 | """ | 164 | """ |
100 | 142 | 165 | WINDOW = "frmPasswordsandEncryptionKeys" | |
101 | 166 | LAUNCHER = "seahorse" | ||
102 | 167 | MNU_NEWKEY = "mnuNew" | ||
103 | 168 | NEWKEY_DLG = "Create New ..." | ||
104 | 169 | BTN_CONTINUE = "btnContinue" | ||
105 | 170 | TYPE_PGP = "PGP Key" | ||
106 | 171 | NEWPGP_DLG = "dlgCreateaPGPKey" | ||
107 | 172 | DLG_NEWPGP_FULLNAME = "txtFullName" | ||
108 | 173 | DLG_NEWPGP_EMAIL = "txtEmailAddress" | ||
109 | 174 | DLG_NEWPGP_COMMENT = "txtComment" | ||
110 | 175 | BTN_NEWPGP_CREATE = "btnCreate" | ||
111 | 176 | DLG_NEWKEY_PASS = "dlgPassphrasefor*" | ||
112 | 177 | BTN_PASS_OK = "btnOK" | ||
113 | 178 | DLG_GENERATING_KEY = "dlgGeneratingkey" | ||
114 | 179 | DLG_CREATING_SSH = "dlgCreatingSecureShellKey" | ||
115 | 180 | TYPE_SSH = "Secure Shell Key" | ||
116 | 181 | NEWSSH_DLG = "New Secure Shell Key" | ||
117 | 182 | DLG_NEWSSH_DESC = "txtKeyDescription" | ||
118 | 183 | BTN_NEWSSH_CREATE_AND_SETUP = "Create and Set Up" | ||
119 | 184 | DLG_SET_UP = "Set Up Computer for SSH Connection" | ||
120 | 185 | TXT_SET_UP_COMPUTER = "txtThehostnameoraddressoftheserver." | ||
121 | 186 | TXT_SET_UP_LOGIN = "txtLoginName" | ||
122 | 187 | BTN_SET_UP = "btnSetUp" | ||
123 | 188 | BTN_NEWSSH_CREATE = "Just Create Key" | ||
124 | 189 | TAB_PERSONAL_KEYS = "My Personal Keys" | ||
125 | 190 | TAB_LIST = "ptl0" | ||
126 | 191 | |||
127 | 143 | def __init__(self): | 192 | def __init__(self): |
129 | 144 | Application.__init__(self, gnome_constants.SH_WINDOW) | 193 | Application.__init__(self) |
130 | 145 | 194 | ||
131 | 146 | def setup(self): | 195 | def setup(self): |
132 | 147 | self.open() | 196 | self.open() |
133 | @@ -154,7 +203,7 @@ | |||
134 | 154 | pass | 203 | pass |
135 | 155 | 204 | ||
136 | 156 | def open(self): | 205 | def open(self): |
138 | 157 | Application.open_and_check_app(self, gnome_constants.SH_LAUNCHER) | 206 | self.open_and_check_app() |
139 | 158 | 207 | ||
140 | 159 | def new_key(self, key_type): | 208 | def new_key(self, key_type): |
141 | 160 | """ | 209 | """ |
142 | @@ -167,7 +216,7 @@ | |||
143 | 167 | seahorse = ooldtp.context(self.name) | 216 | seahorse = ooldtp.context(self.name) |
144 | 168 | 217 | ||
145 | 169 | try: | 218 | try: |
147 | 170 | mnu_new_key = seahorse.getchild(gnome_constants.SH_MNU_NEWKEY) | 219 | mnu_new_key = seahorse.getchild(self.__class__.MNU_NEWKEY) |
148 | 171 | except ldtp.LdtpExecutionError: | 220 | except ldtp.LdtpExecutionError: |
149 | 172 | raise ldtp.LdtpExecutionError, "The new key menu was not found." | 221 | raise ldtp.LdtpExecutionError, "The new key menu was not found." |
150 | 173 | 222 | ||
151 | @@ -177,8 +226,8 @@ | |||
152 | 177 | raise ldtp.LdtpExecutionError, "There was a problem when selecting new key menu item." | 226 | raise ldtp.LdtpExecutionError, "There was a problem when selecting new key menu item." |
153 | 178 | 227 | ||
154 | 179 | try: | 228 | try: |
157 | 180 | ldtp.waittillguiexist(gnome_constants.SH_NEWKEY_DLG) | 229 | ldtp.waittillguiexist(self.__class__.NEWKEY_DLG) |
158 | 181 | dlg_new_key = ooldtp.context(gnome_constants.SH_NEWKEY_DLG) | 230 | dlg_new_key = ooldtp.context(self.__class__.NEWKEY_DLG) |
159 | 182 | except ldtp.LdtpExecutionError: | 231 | except ldtp.LdtpExecutionError: |
160 | 183 | raise ldtp.LdtpExecutionError, "The new key dialog was not found." | 232 | raise ldtp.LdtpExecutionError, "The new key dialog was not found." |
161 | 184 | 233 | ||
162 | @@ -197,7 +246,7 @@ | |||
163 | 197 | raise ldtp.LdtpExecutionError, "Error getting the key types table." | 246 | raise ldtp.LdtpExecutionError, "Error getting the key types table." |
164 | 198 | 247 | ||
165 | 199 | try: | 248 | try: |
167 | 200 | btn_continue = dlg_new_key.getchild(gnome_constants.SH_BTN_CONTINUE) | 249 | btn_continue = dlg_new_key.getchild(self.__class__.BTN_CONTINUE) |
168 | 201 | except ldtp.LdtpExecutionError: | 250 | except ldtp.LdtpExecutionError: |
169 | 202 | raise ldtp.LdtpExecutionError, "The continue button at the new key dialog was not found." | 251 | raise ldtp.LdtpExecutionError, "The continue button at the new key dialog was not found." |
170 | 203 | 252 | ||
171 | @@ -226,16 +275,16 @@ | |||
172 | 226 | @param passphrase: Passphrase to type for the PGP key | 275 | @param passphrase: Passphrase to type for the PGP key |
173 | 227 | """ | 276 | """ |
174 | 228 | 277 | ||
176 | 229 | self.new_key(gnome_constants.SH_TYPE_PGP) | 278 | self.new_key(self.__class__.TYPE_PGP) |
177 | 230 | 279 | ||
178 | 231 | try: | 280 | try: |
181 | 232 | ldtp.waittillguiexist(gnome_constants.SH_NEWPGP_DLG) | 281 | ldtp.waittillguiexist(self.__class__.NEWPGP_DLG) |
182 | 233 | dlg_new_pgp = ooldtp.context(gnome_constants.SH_NEWPGP_DLG) | 282 | dlg_new_pgp = ooldtp.context(self.__class__.NEWPGP_DLG) |
183 | 234 | except ldtp.LdtpExecutionError: | 283 | except ldtp.LdtpExecutionError: |
184 | 235 | raise ldtp.LdtpExecutionError, "The new key dialog was not found." | 284 | raise ldtp.LdtpExecutionError, "The new key dialog was not found." |
185 | 236 | 285 | ||
186 | 237 | try: | 286 | try: |
188 | 238 | txt_field = dlg_new_pgp.getchild(gnome_constants.SH_DLG_NEWPGP_FULLNAME) | 287 | txt_field = dlg_new_pgp.getchild(self.__class__.DLG_NEWPGP_FULLNAME) |
189 | 239 | except ldtp.LdtpExecutionError: | 288 | except ldtp.LdtpExecutionError: |
190 | 240 | raise ldtp.LdtpExecutionError, "The " + txt_field + " text field was not found." | 289 | raise ldtp.LdtpExecutionError, "The " + txt_field + " text field was not found." |
191 | 241 | try: | 290 | try: |
192 | @@ -244,7 +293,7 @@ | |||
193 | 244 | raise ldtp.LdtpExecutionError, "There was an error when writing the text." | 293 | raise ldtp.LdtpExecutionError, "There was an error when writing the text." |
194 | 245 | 294 | ||
195 | 246 | try: | 295 | try: |
197 | 247 | txt_field = dlg_new_pgp.getchild(gnome_constants.SH_DLG_NEWPGP_EMAIL) | 296 | txt_field = dlg_new_pgp.getchild(self.__class__.DLG_NEWPGP_EMAIL) |
198 | 248 | except ldtp.LdtpExecutionError: | 297 | except ldtp.LdtpExecutionError: |
199 | 249 | raise ldtp.LdtpExecutionError, "The " + txt_field + " text field was not found." | 298 | raise ldtp.LdtpExecutionError, "The " + txt_field + " text field was not found." |
200 | 250 | try: | 299 | try: |
201 | @@ -253,7 +302,7 @@ | |||
202 | 253 | raise ldtp.LdtpExecutionError, "There was a problem when writing the text." | 302 | raise ldtp.LdtpExecutionError, "There was a problem when writing the text." |
203 | 254 | 303 | ||
204 | 255 | try: | 304 | try: |
206 | 256 | txt_field = dlg_new_pgp.getchild(gnome_constants.SH_DLG_NEWPGP_COMMENT) | 305 | txt_field = dlg_new_pgp.getchild(self.__class__.DLG_NEWPGP_COMMENT) |
207 | 257 | except ldtp.LdtpExecutionError: | 306 | except ldtp.LdtpExecutionError: |
208 | 258 | raise ldtp.LdtpExecutionError, "The " + txt_field + " text field was not found." | 307 | raise ldtp.LdtpExecutionError, "The " + txt_field + " text field was not found." |
209 | 259 | try: | 308 | try: |
210 | @@ -262,7 +311,7 @@ | |||
211 | 262 | raise ldtp.LdtpExecutionError, "There was a problem when writing the text." | 311 | raise ldtp.LdtpExecutionError, "There was a problem when writing the text." |
212 | 263 | 312 | ||
213 | 264 | try: | 313 | try: |
215 | 265 | btn_create = dlg_new_pgp.getchild(gnome_constants.SH_BTN_NEWPGP_CREATE) | 314 | btn_create = dlg_new_pgp.getchild(self.__class__.BTN_NEWPGP_CREATE) |
216 | 266 | except ldtp.LdtpExecutionError: | 315 | except ldtp.LdtpExecutionError: |
217 | 267 | raise ldtp.LdtpExecutionError, "The create button at the new PGP key dialog was not found." | 316 | raise ldtp.LdtpExecutionError, "The create button at the new PGP key dialog was not found." |
218 | 268 | 317 | ||
219 | @@ -272,8 +321,8 @@ | |||
220 | 272 | raise ldtp.LdtpExecutionError, "There was a problem when clicking the create button." | 321 | raise ldtp.LdtpExecutionError, "There was a problem when clicking the create button." |
221 | 273 | 322 | ||
222 | 274 | try: | 323 | try: |
225 | 275 | ldtp.waittillguiexist(gnome_constants.SH_DLG_NEWKEY_PASS) | 324 | ldtp.waittillguiexist(self.__class__.DLG_NEWKEY_PASS) |
226 | 276 | dlg_new_pgp_pass = ooldtp.context(gnome_constants.SH_DLG_NEWKEY_PASS) | 325 | dlg_new_pgp_pass = ooldtp.context(self.__class__.DLG_NEWKEY_PASS) |
227 | 277 | except ldtp.LdtpExecutionError: | 326 | except ldtp.LdtpExecutionError: |
228 | 278 | raise ldtp.LdtpExecutionError, "The new pgp key passphrase dialog was not found." | 327 | raise ldtp.LdtpExecutionError, "The new pgp key passphrase dialog was not found." |
229 | 279 | 328 | ||
230 | @@ -285,7 +334,7 @@ | |||
231 | 285 | raise ldtp.LdtpExecutionError, "Error entering passphrase." | 334 | raise ldtp.LdtpExecutionError, "Error entering passphrase." |
232 | 286 | 335 | ||
233 | 287 | try: | 336 | try: |
235 | 288 | btn_pass_ok = dlg_new_pgp_pass.getchild(gnome_constants.SH_BTN_PASS_OK) | 337 | btn_pass_ok = dlg_new_pgp_pass.getchild(self.__class__.BTN_PASS_OK) |
236 | 289 | except ldtp.LdtpExecutionError: | 338 | except ldtp.LdtpExecutionError: |
237 | 290 | raise ldtp.LdtpExecutionError, "The OK button at the new PGP key passphrase dialog was not found." | 339 | raise ldtp.LdtpExecutionError, "The OK button at the new PGP key passphrase dialog was not found." |
238 | 291 | 340 | ||
239 | @@ -295,8 +344,8 @@ | |||
240 | 295 | raise ldtp.LdtpExecutionError, "There was a problem when clicking the OK button." | 344 | raise ldtp.LdtpExecutionError, "There was a problem when clicking the OK button." |
241 | 296 | 345 | ||
242 | 297 | try: | 346 | try: |
245 | 298 | ldtp.waittillguiexist(gnome_constants.SH_DLG_GENERATING_KEY) | 347 | ldtp.waittillguiexist(self.__class__.DLG_GENERATING_KEY) |
246 | 299 | while ldtp.guiexist(gnome_constants.SH_DLG_GENERATING_KEY) == 1: | 348 | while ldtp.guiexist(self.__class__.DLG_GENERATING_KEY) == 1: |
247 | 300 | ldtp.wait(1) | 349 | ldtp.wait(1) |
248 | 301 | except ldtp.LdtpExecutionError: | 350 | except ldtp.LdtpExecutionError: |
249 | 302 | raise ldtp.LdtpExecutionError, "The new pgp generating key dialog was not found." | 351 | raise ldtp.LdtpExecutionError, "The new pgp generating key dialog was not found." |
250 | @@ -324,18 +373,18 @@ | |||
251 | 324 | @param login: Login to use in the remote computer | 373 | @param login: Login to use in the remote computer |
252 | 325 | """ | 374 | """ |
253 | 326 | 375 | ||
255 | 327 | self.new_key(gnome_constants.SH_TYPE_SSH) | 376 | self.new_key(self.__class__.TYPE_SSH) |
256 | 328 | 377 | ||
257 | 329 | try: | 378 | try: |
260 | 330 | ldtp.waittillguiexist(gnome_constants.SH_NEWSSH_DLG) | 379 | ldtp.waittillguiexist(self.__class__.NEWSSH_DLG) |
261 | 331 | dlg_new_ssh = ooldtp.context(gnome_constants.SH_NEWSSH_DLG) | 380 | dlg_new_ssh = ooldtp.context(self.__class__.NEWSSH_DLG) |
262 | 332 | except ldtp.LdtpExecutionError: | 381 | except ldtp.LdtpExecutionError: |
263 | 333 | raise ldtp.LdtpExecutionError, "The new key dialog was not found." | 382 | raise ldtp.LdtpExecutionError, "The new key dialog was not found." |
264 | 334 | 383 | ||
265 | 335 | try: | 384 | try: |
267 | 336 | txt_field = dlg_new_ssh.getchild(gnome_constants.SH_DLG_NEWSSH_DESC) | 385 | txt_field = dlg_new_ssh.getchild(self.__class__.DLG_NEWSSH_DESC) |
268 | 337 | except ldtp.LdtpExecutionError: | 386 | except ldtp.LdtpExecutionError: |
270 | 338 | raise ldtp.LdtpExecutionError, "The " + gnome_constants.SH_DLG_NEWSSH_DESC + " text field was not found." | 387 | raise ldtp.LdtpExecutionError, "The " + self.__class__.DLG_NEWSSH_DESC + " text field was not found." |
271 | 339 | try: | 388 | try: |
272 | 340 | txt_field.settextvalue(description) | 389 | txt_field.settextvalue(description) |
273 | 341 | except ldtp.LdtpExecutionError: | 390 | except ldtp.LdtpExecutionError: |
274 | @@ -343,13 +392,13 @@ | |||
275 | 343 | 392 | ||
276 | 344 | if set_up == True: | 393 | if set_up == True: |
277 | 345 | try: | 394 | try: |
279 | 346 | btn_create = dlg_new_ssh.getchild(gnome_constants.SH_BTN_NEWSSH_CREATE_AND_SETUP) | 395 | btn_create = dlg_new_ssh.getchild(self.__class__.BTN_NEWSSH_CREATE_AND_SETUP) |
280 | 347 | except ldtp.LdtpExecutionError: | 396 | except ldtp.LdtpExecutionError: |
281 | 348 | raise ldtp.LdtpExecutionError, "The create button at the new PGP key dialog was not found." | 397 | raise ldtp.LdtpExecutionError, "The create button at the new PGP key dialog was not found." |
282 | 349 | 398 | ||
283 | 350 | else: | 399 | else: |
284 | 351 | try: | 400 | try: |
286 | 352 | btn_create = dlg_new_ssh.getchild(gnome_constants.SH_BTN_NEWSSH_CREATE) | 401 | btn_create = dlg_new_ssh.getchild(self.__class__.BTN_NEWSSH_CREATE) |
287 | 353 | except ldtp.LdtpExecutionError: | 402 | except ldtp.LdtpExecutionError: |
288 | 354 | raise ldtp.LdtpExecutionError, "The create button at the new PGP key dialog was not found." | 403 | raise ldtp.LdtpExecutionError, "The create button at the new PGP key dialog was not found." |
289 | 355 | 404 | ||
290 | @@ -360,8 +409,8 @@ | |||
291 | 360 | 409 | ||
292 | 361 | 410 | ||
293 | 362 | try: | 411 | try: |
296 | 363 | ldtp.waittillguiexist(gnome_constants.SH_DLG_NEWKEY_PASS) | 412 | ldtp.waittillguiexist(self.__class__.DLG_NEWKEY_PASS) |
297 | 364 | dlg_new_key_pass = ooldtp.context(gnome_constants.SH_DLG_NEWKEY_PASS) | 413 | dlg_new_key_pass = ooldtp.context(self.__class__.DLG_NEWKEY_PASS) |
298 | 365 | except ldtp.LdtpExecutionError: | 414 | except ldtp.LdtpExecutionError: |
299 | 366 | raise ldtp.LdtpExecutionError, "The new key passphrase dialog was not found." | 415 | raise ldtp.LdtpExecutionError, "The new key passphrase dialog was not found." |
300 | 367 | 416 | ||
301 | @@ -373,7 +422,7 @@ | |||
302 | 373 | raise ldtp.LdtpExecutionError, "Error entering passphrase." | 422 | raise ldtp.LdtpExecutionError, "Error entering passphrase." |
303 | 374 | 423 | ||
304 | 375 | try: | 424 | try: |
306 | 376 | btn_pass_ok = dlg_new_key_pass.getchild(gnome_constants.SH_BTN_PASS_OK) | 425 | btn_pass_ok = dlg_new_key_pass.getchild(self.__class__.BTN_PASS_OK) |
307 | 377 | except ldtp.LdtpExecutionError: | 426 | except ldtp.LdtpExecutionError: |
308 | 378 | raise ldtp.LdtpExecutionError, "The OK button at the new key passphrase dialog was not found." | 427 | raise ldtp.LdtpExecutionError, "The OK button at the new key passphrase dialog was not found." |
309 | 379 | 428 | ||
310 | @@ -385,15 +434,15 @@ | |||
311 | 385 | if set_up == True and login is not None: | 434 | if set_up == True and login is not None: |
312 | 386 | 435 | ||
313 | 387 | try: | 436 | try: |
316 | 388 | ldtp.waittillguiexist(gnome_constants.SH_DLG_SET_UP) | 437 | ldtp.waittillguiexist(self.__class__.DLG_SET_UP) |
317 | 389 | dlg_set_up_computer = ooldtp.context(gnome_constants.SH_DLG_SET_UP) | 438 | dlg_set_up_computer = ooldtp.context(self.__class__.DLG_SET_UP) |
318 | 390 | except ldtp.LdtpExecutionError: | 439 | except ldtp.LdtpExecutionError: |
319 | 391 | raise ldtp.LdtpExecutionError, "The set up computer dialog was not found." | 440 | raise ldtp.LdtpExecutionError, "The set up computer dialog was not found." |
320 | 392 | 441 | ||
321 | 393 | try: | 442 | try: |
323 | 394 | txt_field = dlg_set_up_computer.getchild(gnome_constants.SH_TXT_SET_UP_LOGIN) | 443 | txt_field = dlg_set_up_computer.getchild(self.__class__.TXT_SET_UP_LOGIN) |
324 | 395 | except ldtp.LdtpExecutionError: | 444 | except ldtp.LdtpExecutionError: |
326 | 396 | raise ldtp.LdtpExecutionError, "The " + gnome_constants.SH_TXT_SET_UP_LOGIN + " text field was not found." | 445 | raise ldtp.LdtpExecutionError, "The " + self.__class__.TXT_SET_UP_LOGIN + " text field was not found." |
327 | 397 | try: | 446 | try: |
328 | 398 | txt_field.settextvalue(login) | 447 | txt_field.settextvalue(login) |
329 | 399 | except ldtp.LdtpExecutionError: | 448 | except ldtp.LdtpExecutionError: |
330 | @@ -401,16 +450,16 @@ | |||
331 | 401 | 450 | ||
332 | 402 | if set_up == True: | 451 | if set_up == True: |
333 | 403 | try: | 452 | try: |
335 | 404 | txt_field = dlg_set_up_computer.getchild(gnome_constants.SH_TXT_SET_UP_COMPUTER) | 453 | txt_field = dlg_set_up_computer.getchild(self.__class__.TXT_SET_UP_COMPUTER) |
336 | 405 | except ldtp.LdtpExecutionError: | 454 | except ldtp.LdtpExecutionError: |
338 | 406 | raise ldtp.LdtpExecutionError, "The " + gnome_constants.SH_TXT_SET_UP_COMPUTER + " text field was not found." | 455 | raise ldtp.LdtpExecutionError, "The " + self.__class__.TXT_SET_UP_COMPUTER + " text field was not found." |
339 | 407 | try: | 456 | try: |
340 | 408 | txt_field.settextvalue(computer) | 457 | txt_field.settextvalue(computer) |
341 | 409 | except ldtp.LdtpExecutionError: | 458 | except ldtp.LdtpExecutionError: |
342 | 410 | raise ldtp.LdtpExecutionError, "There was an error when writing the text." | 459 | raise ldtp.LdtpExecutionError, "There was an error when writing the text." |
343 | 411 | 460 | ||
344 | 412 | try: | 461 | try: |
346 | 413 | btn_set_up = dlg_set_up_computer.getchild(gnome_constants.SH_BTN_SET_UP) | 462 | btn_set_up = dlg_set_up_computer.getchild(self.__class__.BTN_SET_UP) |
347 | 414 | except ldtp.LdtpExecutionError: | 463 | except ldtp.LdtpExecutionError: |
348 | 415 | raise ldtp.LdtpExecutionError, "The set up button was not found." | 464 | raise ldtp.LdtpExecutionError, "The set up button was not found." |
349 | 416 | 465 | ||
350 | @@ -420,7 +469,7 @@ | |||
351 | 420 | raise ldtp.LdtpExecutionError, "There was a problem when clicking the set up button." | 469 | raise ldtp.LdtpExecutionError, "There was a problem when clicking the set up button." |
352 | 421 | 470 | ||
353 | 422 | try: | 471 | try: |
355 | 423 | while ldtp.guiexist(gnome_constants.SH_DLG_CREATING_SSH) == 1: | 472 | while ldtp.guiexist(self.__class__.DLG_CREATING_SSH) == 1: |
356 | 424 | ldtp.wait(1) | 473 | ldtp.wait(1) |
357 | 425 | 474 | ||
358 | 426 | except ldtp.LdtpExecutionError: | 475 | except ldtp.LdtpExecutionError: |
359 | @@ -429,7 +478,7 @@ | |||
360 | 429 | # It is too fast to grab the main window afterwards | 478 | # It is too fast to grab the main window afterwards |
361 | 430 | ldtp.wait(3) | 479 | ldtp.wait(3) |
362 | 431 | 480 | ||
364 | 432 | def assert_exists_key(self, name, tab_name = gnome_constants.SH_TAB_PERSONAL_KEYS): | 481 | def assert_exists_key(self, name, tab_name = None): |
365 | 433 | """ | 482 | """ |
366 | 434 | It checks that the KEY with description 'description' is | 483 | It checks that the KEY with description 'description' is |
367 | 435 | part of the keys of the current user | 484 | part of the keys of the current user |
368 | @@ -440,12 +489,14 @@ | |||
369 | 440 | @type tab_name: string | 489 | @type tab_name: string |
370 | 441 | @param tab_name: The tab name to search for the key. | 490 | @param tab_name: The tab name to search for the key. |
371 | 442 | """ | 491 | """ |
372 | 492 | if not tab_name: | ||
373 | 493 | tab_name = self.__class__.TAB_PERSONAL_KEYS | ||
374 | 443 | 494 | ||
375 | 444 | seahorse = ooldtp.context(self.name) | 495 | seahorse = ooldtp.context(self.name) |
376 | 445 | try: | 496 | try: |
377 | 446 | 497 | ||
380 | 447 | page_list = seahorse.getchild(gnome_constants.SH_TAB_LIST) | 498 | page_list = seahorse.getchild(self.__class__.TAB_LIST) |
381 | 448 | page_list.selecttab(gnome_constants.SH_TAB_PERSONAL_KEYS) | 499 | page_list.selecttab(self.__class__.TAB_PERSONAL_KEYS) |
382 | 449 | scroll_pane = ldtp.getobjectproperty(self.name, tab_name, 'children') | 500 | scroll_pane = ldtp.getobjectproperty(self.name, tab_name, 'children') |
383 | 450 | list_keys = ldtp.getobjectproperty(self.name, scroll_pane, 'children') | 501 | list_keys = ldtp.getobjectproperty(self.name, scroll_pane, 'children') |
384 | 451 | list_keys = list_keys.split(' ')[0] | 502 | list_keys = list_keys.split(' ')[0] |
385 | @@ -464,9 +515,22 @@ | |||
386 | 464 | """ | 515 | """ |
387 | 465 | GEdit manages the Gedit application. | 516 | GEdit manages the Gedit application. |
388 | 466 | """ | 517 | """ |
390 | 467 | 518 | WINDOW = "frm*gedit" | |
391 | 519 | TXT_FIELD = "txt1" | ||
392 | 520 | LAUNCHER = "gedit" | ||
393 | 521 | SAVE_DLG = "dlgSave*" | ||
394 | 522 | SAVE_DLG_TXT_NAME = "txtName" | ||
395 | 523 | SAVE_DLG_BTN_SAVE = "btnSave" | ||
396 | 524 | QUESTION_DLG = "dlgQuestion" | ||
397 | 525 | QUESTION_DLG_BTN_SAVE = "btnSave" | ||
398 | 526 | QUESTION_DLG_BTN_SAVE_AS = "btnSaveAs" | ||
399 | 527 | QUESTION_DLG_BTN_CLOSE = "btnClosewithoutSaving" | ||
400 | 528 | MNU_QUIT = "mnuQuit" | ||
401 | 529 | MNU_CLOSE = "mnuClose" | ||
402 | 530 | MNU_NEW = "mnuNew" | ||
403 | 531 | |||
404 | 468 | def __init__(self): | 532 | def __init__(self): |
406 | 469 | Application.__init__(self, gnome_constants.GE_WINDOW) | 533 | Application.__init__(self) |
407 | 470 | 534 | ||
408 | 471 | def setup(self): | 535 | def setup(self): |
409 | 472 | self.open() | 536 | self.open() |
410 | @@ -479,30 +543,30 @@ | |||
411 | 479 | try: | 543 | try: |
412 | 480 | try: | 544 | try: |
413 | 481 | gedit = ooldtp.context(self.name) | 545 | gedit = ooldtp.context(self.name) |
415 | 482 | quit_menu = gedit.getchild(gnome_constants.GE_MNU_CLOSE) | 546 | quit_menu = gedit.getchild(self.__class__.MNU_CLOSE) |
416 | 483 | except ldtp.LdtpExecutionError: | 547 | except ldtp.LdtpExecutionError: |
417 | 484 | raise ldtp.LdtpExecutionError, "The quit menu was not found." | 548 | raise ldtp.LdtpExecutionError, "The quit menu was not found." |
418 | 485 | quit_menu.selectmenuitem() | 549 | quit_menu.selectmenuitem() |
419 | 486 | except ldtp.LdtpExecutionError: | 550 | except ldtp.LdtpExecutionError: |
420 | 487 | raise ldtp.LdtpExecutionError, "Mmm, something went wrong when closing the application." | 551 | raise ldtp.LdtpExecutionError, "Mmm, something went wrong when closing the application." |
421 | 488 | 552 | ||
423 | 489 | result = ldtp.waittillguiexist(gnome_constants.GE_QUESTION_DLG, | 553 | result = ldtp.waittillguiexist(self.__class__.QUESTION_DLG, |
424 | 490 | guiTimeOut = 2) | 554 | guiTimeOut = 2) |
425 | 491 | 555 | ||
426 | 492 | if result == 1: | 556 | if result == 1: |
429 | 493 | question_dialog = ooldtp.context(gnome_constants.GE_QUESTION_DLG) | 557 | question_dialog = ooldtp.context(self.__class__.QUESTION_DLG) |
430 | 494 | question_dlg_btn_close = question_dialog.getchild(gnome_constants.GE_QUESTION_DLG_BTN_CLOSE) | 558 | question_dlg_btn_close = question_dialog.getchild(self.__class__.QUESTION_DLG_BTN_CLOSE) |
431 | 495 | question_dlg_btn_close.click() | 559 | question_dlg_btn_close.click() |
432 | 496 | 560 | ||
433 | 497 | try: | 561 | try: |
434 | 498 | gedit = ooldtp.context(self.name) | 562 | gedit = ooldtp.context(self.name) |
436 | 499 | new_menu = gedit.getchild(gnome_constants.GE_MNU_NEW) | 563 | new_menu = gedit.getchild(self.__class__.MNU_NEW) |
437 | 500 | except ldtp.LdtpExecutionError: | 564 | except ldtp.LdtpExecutionError: |
438 | 501 | raise ldtp.LdtpExecutionError, "The new menu was not found." | 565 | raise ldtp.LdtpExecutionError, "The new menu was not found." |
439 | 502 | new_menu.selectmenuitem() | 566 | new_menu.selectmenuitem() |
440 | 503 | 567 | ||
441 | 504 | result = ldtp.waittillguiexist( | 568 | result = ldtp.waittillguiexist( |
443 | 505 | self.name, gnome_constants.GE_TXT_FIELD) | 569 | self.name, self.__class__.TXT_FIELD) |
444 | 506 | if result != 1: | 570 | if result != 1: |
445 | 507 | raise ldtp.LdtpExecutionError, "Failed to set up new document." | 571 | raise ldtp.LdtpExecutionError, "Failed to set up new document." |
446 | 508 | 572 | ||
447 | @@ -514,7 +578,7 @@ | |||
448 | 514 | @type text: string | 578 | @type text: string |
449 | 515 | @param text: The text string to be written to the current buffer. | 579 | @param text: The text string to be written to the current buffer. |
450 | 516 | """ | 580 | """ |
452 | 517 | Application.write_text(self, text, gnome_constants.GE_TXT_FIELD) | 581 | Application.write_text(self, text, self.__class__.TXT_FIELD) |
453 | 518 | 582 | ||
454 | 519 | def save(self, filename): | 583 | def save(self, filename): |
455 | 520 | """ | 584 | """ |
456 | @@ -529,12 +593,12 @@ | |||
457 | 529 | ooldtp.context(self.name) | 593 | ooldtp.context(self.name) |
458 | 530 | 594 | ||
459 | 531 | try: | 595 | try: |
462 | 532 | ldtp.waittillguiexist(gnome_constants.GE_SAVE_DLG) | 596 | ldtp.waittillguiexist(self.__class__.SAVE_DLG) |
463 | 533 | save_dialog = ooldtp.context(gnome_constants.GE_SAVE_DLG) | 597 | save_dialog = ooldtp.context(self.__class__.SAVE_DLG) |
464 | 534 | except ldtp.LdtpExecutionError: | 598 | except ldtp.LdtpExecutionError: |
465 | 535 | raise ldtp.LdtpExecutionError, "The Gedit save dialog was not found." | 599 | raise ldtp.LdtpExecutionError, "The Gedit save dialog was not found." |
466 | 536 | try: | 600 | try: |
468 | 537 | save_dlg_txt_filename = save_dialog.getchild(gnome_constants.GE_SAVE_DLG_TXT_NAME) | 601 | save_dlg_txt_filename = save_dialog.getchild(self.__class__.SAVE_DLG_TXT_NAME) |
469 | 538 | except ldtp.LdtpExecutionError: | 602 | except ldtp.LdtpExecutionError: |
470 | 539 | raise ldtp.LdtpExecutionError, "The filename txt field in Gedit save dialog was not found." | 603 | raise ldtp.LdtpExecutionError, "The filename txt field in Gedit save dialog was not found." |
471 | 540 | try: | 604 | try: |
472 | @@ -544,7 +608,7 @@ | |||
473 | 544 | raise ldtp.LdtpExecutionError, "We couldn't write text." | 608 | raise ldtp.LdtpExecutionError, "We couldn't write text." |
474 | 545 | 609 | ||
475 | 546 | try: | 610 | try: |
477 | 547 | save_dlg_btn_save = save_dialog.getchild(gnome_constants.GE_SAVE_DLG_BTN_SAVE) | 611 | save_dlg_btn_save = save_dialog.getchild(self.__class__.SAVE_DLG_BTN_SAVE) |
478 | 548 | except ldtp.LdtpExecutionError: | 612 | except ldtp.LdtpExecutionError: |
479 | 549 | raise ldtp.LdtpExecutionError, "The button Save in Gedit save dialog was not found." | 613 | raise ldtp.LdtpExecutionError, "The button Save in Gedit save dialog was not found." |
480 | 550 | 614 | ||
481 | @@ -553,7 +617,7 @@ | |||
482 | 553 | except ldtp.LdtpExecutionError: | 617 | except ldtp.LdtpExecutionError: |
483 | 554 | raise ldtp.LdtpExecutionError, "There was an error when pushing the Save button." | 618 | raise ldtp.LdtpExecutionError, "There was an error when pushing the Save button." |
484 | 555 | 619 | ||
486 | 556 | ldtp.waittillguinotexist(gnome_constants.GE_SAVE_DLG) | 620 | ldtp.waittillguinotexist(self.__class__.SAVE_DLG) |
487 | 557 | 621 | ||
488 | 558 | def open(self): | 622 | def open(self): |
489 | 559 | """ | 623 | """ |
490 | @@ -561,7 +625,7 @@ | |||
491 | 561 | didn't start properly. | 625 | didn't start properly. |
492 | 562 | 626 | ||
493 | 563 | """ | 627 | """ |
495 | 564 | Application.open_and_check_app(self, gnome_constants.GE_LAUNCHER) | 628 | self.open_and_check_app() |
496 | 565 | 629 | ||
497 | 566 | def exit(self, save=False, filename=''): | 630 | def exit(self, save=False, filename=''): |
498 | 567 | """ | 631 | """ |
499 | @@ -579,42 +643,42 @@ | |||
500 | 579 | try: | 643 | try: |
501 | 580 | gedit = ooldtp.context(self.name) | 644 | gedit = ooldtp.context(self.name) |
502 | 581 | try: | 645 | try: |
504 | 582 | quit_menu = gedit.getchild(gnome_constants.GE_MNU_QUIT) | 646 | quit_menu = gedit.getchild(self.__class__.MNU_QUIT) |
505 | 583 | except ldtp.LdtpExecutionError: | 647 | except ldtp.LdtpExecutionError: |
506 | 584 | raise ldtp.LdtpExecutionError, "The quit menu was not found." | 648 | raise ldtp.LdtpExecutionError, "The quit menu was not found." |
507 | 585 | quit_menu.selectmenuitem() | 649 | quit_menu.selectmenuitem() |
508 | 586 | except ldtp.LdtpExecutionError: | 650 | except ldtp.LdtpExecutionError: |
509 | 587 | raise ldtp.LdtpExecutionError, "Mmm, something went wrong when closing the application." | 651 | raise ldtp.LdtpExecutionError, "Mmm, something went wrong when closing the application." |
510 | 588 | 652 | ||
512 | 589 | response = ldtp.waittillguiexist(gnome_constants.GE_QUESTION_DLG, '', 20) | 653 | response = ldtp.waittillguiexist(self.__class__.QUESTION_DLG, '', 20) |
513 | 590 | 654 | ||
514 | 591 | # If the text has changed, the save dialog will appear | 655 | # If the text has changed, the save dialog will appear |
515 | 592 | if response == 1: | 656 | if response == 1: |
516 | 593 | try: | 657 | try: |
518 | 594 | question_dialog = ooldtp.context(gnome_constants.GE_QUESTION_DLG) | 658 | question_dialog = ooldtp.context(self.__class__.QUESTION_DLG) |
519 | 595 | except ldtp.LdtpExecutionError: | 659 | except ldtp.LdtpExecutionError: |
520 | 596 | raise ldtp.LdtpExecutionError, "The Gedit question dialog was not found." | 660 | raise ldtp.LdtpExecutionError, "The Gedit question dialog was not found." |
521 | 597 | 661 | ||
522 | 598 | # Test if the file needs to be saved | 662 | # Test if the file needs to be saved |
523 | 599 | if save: | 663 | if save: |
524 | 600 | try: | 664 | try: |
526 | 601 | question_dlg_btn_save = question_dialog.getchild(gnome_constants.GE_QUESTION_DLG_BTN_SAVE) | 665 | question_dlg_btn_save = question_dialog.getchild(self.__class__.QUESTION_DLG_BTN_SAVE) |
527 | 602 | question_dlg_btn_save.click() | 666 | question_dlg_btn_save.click() |
528 | 603 | except ldtp.LdtpExecutionError: | 667 | except ldtp.LdtpExecutionError: |
529 | 604 | # If the Save button was not found, we will try to find the Save As | 668 | # If the Save button was not found, we will try to find the Save As |
530 | 605 | try: | 669 | try: |
532 | 606 | question_dlg_btn_save = question_dialog.getchild(gnome_constants.GE_QUESTION_DLG_BTN_SAVE_AS) | 670 | question_dlg_btn_save = question_dialog.getchild(self.__class__.QUESTION_DLG_BTN_SAVE_AS) |
533 | 607 | question_dlg_btn_save.click() | 671 | question_dlg_btn_save.click() |
534 | 608 | except ldtp.LdtpExecutionError: | 672 | except ldtp.LdtpExecutionError: |
535 | 609 | raise ldtp.LdtpExecutionError, "The save or save as buttons in Gedit question dialog were not found." | 673 | raise ldtp.LdtpExecutionError, "The save or save as buttons in Gedit question dialog were not found." |
536 | 610 | 674 | ||
537 | 611 | try: | 675 | try: |
540 | 612 | ldtp.waittillguiexist(gnome_constants.GE_SAVE_DLG) | 676 | ldtp.waittillguiexist(self.__class__.SAVE_DLG) |
541 | 613 | save_dialog = ooldtp.context(gnome_constants.GE_SAVE_DLG) | 677 | save_dialog = ooldtp.context(self.__class__.SAVE_DLG) |
542 | 614 | except ldtp.LdtpExecutionError: | 678 | except ldtp.LdtpExecutionError: |
543 | 615 | raise ldtp.LdtpExecutionError, "The Gedit save dialog was not found." | 679 | raise ldtp.LdtpExecutionError, "The Gedit save dialog was not found." |
544 | 616 | try: | 680 | try: |
546 | 617 | save_dlg_txt_filename = save_dialog.getchild(gnome_constants.GE_SAVE_DLG_TXT_NAME) | 681 | save_dlg_txt_filename = save_dialog.getchild(self.__class__.SAVE_DLG_TXT_NAME) |
547 | 618 | except ldtp.LdtpExecutionError: | 682 | except ldtp.LdtpExecutionError: |
548 | 619 | raise ldtp.LdtpExecutionError, "The filename txt field in Gedit save dialog was not found." | 683 | raise ldtp.LdtpExecutionError, "The filename txt field in Gedit save dialog was not found." |
549 | 620 | try: | 684 | try: |
550 | @@ -624,7 +688,7 @@ | |||
551 | 624 | raise ldtp.LdtpExecutionError, "There was an error when writing the text." | 688 | raise ldtp.LdtpExecutionError, "There was an error when writing the text." |
552 | 625 | 689 | ||
553 | 626 | try: | 690 | try: |
555 | 627 | save_dlg_btn_save = save_dialog.getchild(gnome_constants.GE_SAVE_DLG_BTN_SAVE) | 691 | save_dlg_btn_save = save_dialog.getchild(self.__class__.SAVE_DLG_BTN_SAVE) |
556 | 628 | except ldtp.LdtpExecutionError: | 692 | except ldtp.LdtpExecutionError: |
557 | 629 | raise ldtp.LdtpExecutionError, "The save button in Gedit save dialog was not found." | 693 | raise ldtp.LdtpExecutionError, "The save button in Gedit save dialog was not found." |
558 | 630 | 694 | ||
559 | @@ -633,11 +697,11 @@ | |||
560 | 633 | except ldtp.LdtpExecutionError: | 697 | except ldtp.LdtpExecutionError: |
561 | 634 | raise ldtp.LdtpExecutionError, "There was an error when pushing the Save button." | 698 | raise ldtp.LdtpExecutionError, "There was an error when pushing the Save button." |
562 | 635 | 699 | ||
564 | 636 | ldtp.waittillguinotexist(gnome_constants.GE_SAVE_DLG) | 700 | ldtp.waittillguinotexist(self.__class__.SAVE_DLG) |
565 | 637 | 701 | ||
566 | 638 | else: | 702 | else: |
567 | 639 | try: | 703 | try: |
569 | 640 | question_dlg_btn_close = question_dialog.getchild(gnome_constants.GE_QUESTION_DLG_BTN_CLOSE) | 704 | question_dlg_btn_close = question_dialog.getchild(self.__class__.QUESTION_DLG_BTN_CLOSE) |
570 | 641 | question_dlg_btn_close.click() | 705 | question_dlg_btn_close.click() |
571 | 642 | except ldtp.LdtpExecutionError: | 706 | except ldtp.LdtpExecutionError: |
572 | 643 | raise ldtp.LdtpExecutionError, "It was not possible to click the close button." | 707 | raise ldtp.LdtpExecutionError, "It was not possible to click the close button." |
573 | @@ -648,7 +712,12 @@ | |||
574 | 648 | """ | 712 | """ |
575 | 649 | PolicyKit class manages the GNOME pop up that ask for password for admin activities. | 713 | PolicyKit class manages the GNOME pop up that ask for password for admin activities. |
576 | 650 | """ | 714 | """ |
578 | 651 | 715 | WINDOW = "dlg0" | |
579 | 716 | TXT_PASS = "txtPassword" | ||
580 | 717 | BTN_OK = "btnOK" | ||
581 | 718 | BTN_CANCEL = "btnCancel" | ||
582 | 719 | |||
583 | 720 | |||
584 | 652 | def __init__(self, password): | 721 | def __init__(self, password): |
585 | 653 | """ | 722 | """ |
586 | 654 | UpdateManager class main constructor | 723 | UpdateManager class main constructor |
587 | @@ -657,7 +726,7 @@ | |||
588 | 657 | @param password: User's password for administrative tasks. | 726 | @param password: User's password for administrative tasks. |
589 | 658 | 727 | ||
590 | 659 | """ | 728 | """ |
592 | 660 | Application.__init__(self, gnome_constants.SU_WINDOW) | 729 | Application.__init__(self) |
593 | 661 | self.password = password | 730 | self.password = password |
594 | 662 | 731 | ||
595 | 663 | def wait(self): | 732 | def wait(self): |
596 | @@ -666,14 +735,14 @@ | |||
597 | 666 | 735 | ||
598 | 667 | @return 1, if the gksu window exists, 0 otherwise. | 736 | @return 1, if the gksu window exists, 0 otherwise. |
599 | 668 | """ | 737 | """ |
601 | 669 | return ldtp.waittillguiexist(gnome_constants.SU_WINDOW) | 738 | return ldtp.waittillguiexist(self.name) |
602 | 670 | 739 | ||
603 | 671 | def set_password(self): | 740 | def set_password(self): |
604 | 672 | """ | 741 | """ |
605 | 673 | It enters the password in the text field and clicks enter. | 742 | It enters the password in the text field and clicks enter. |
606 | 674 | """ | 743 | """ |
607 | 675 | 744 | ||
609 | 676 | ooldtp.context(gnome_constants.SU_WINDOW) | 745 | ooldtp.context(self.name) |
610 | 677 | 746 | ||
611 | 678 | try: | 747 | try: |
612 | 679 | ldtp.enterstring (self.password) | 748 | ldtp.enterstring (self.password) |
613 | @@ -684,25 +753,25 @@ | |||
614 | 684 | 753 | ||
615 | 685 | # TODO: Change this to use ooldtp | 754 | # TODO: Change this to use ooldtp |
616 | 686 | # try: | 755 | # try: |
618 | 687 | # btnOK = polKit.getchild(gnome_constants.SU_BTN_OK) | 756 | # btnOK = polKit.getchild(self.__class__.BTN_OK) |
619 | 688 | # except ldtp.LdtpExecutionError, msg: | 757 | # except ldtp.LdtpExecutionError, msg: |
620 | 689 | # raise ldtp.LdtpExecutionError, "The GtkSudo OK button was not found." | 758 | # raise ldtp.LdtpExecutionError, "The GtkSudo OK button was not found." |
621 | 690 | # | 759 | # |
622 | 691 | # btnOK.click() | 760 | # btnOK.click() |
623 | 692 | 761 | ||
624 | 693 | #This also have problems because of the lack of accesibiliy information | 762 | #This also have problems because of the lack of accesibiliy information |
626 | 694 | #ldtp.waittillguinotexist (gnome_constants.SU_WINDOW) | 763 | #ldtp.waittillguinotexist (self.name) |
627 | 695 | 764 | ||
628 | 696 | def cancel(self): | 765 | def cancel(self): |
630 | 697 | polKit = ooldtp.context(gnome_constants.SU_WINDOW) | 766 | polKit = ooldtp.context(self.name) |
631 | 698 | 767 | ||
632 | 699 | try: | 768 | try: |
634 | 700 | cancelButton = polKit.getchild(gnome_constants.SU_BTN_CANCEL) | 769 | cancelButton = polKit.getchild(self.__class__.BTN_CANCEL) |
635 | 701 | except ldtp.LdtpExecutionError: | 770 | except ldtp.LdtpExecutionError: |
636 | 702 | raise ldtp.LdtpExecutionError, "The PolicyKit cancel button was not found." | 771 | raise ldtp.LdtpExecutionError, "The PolicyKit cancel button was not found." |
637 | 703 | 772 | ||
638 | 704 | cancelButton.click() | 773 | cancelButton.click() |
640 | 705 | ldtp.waittillguinotexist (gnome_constants.SU_WINDOW) | 774 | ldtp.waittillguinotexist (self.name) |
641 | 706 | 775 | ||
642 | 707 | 776 | ||
643 | 708 | 777 | ||
644 | 709 | 778 | ||
645 | === removed file 'desktoptesting/gnome_constants.py' | |||
646 | --- desktoptesting/gnome_constants.py 2009-03-19 10:47:43 +0000 | |||
647 | +++ desktoptesting/gnome_constants.py 1970-01-01 00:00:00 +0000 | |||
648 | @@ -1,58 +0,0 @@ | |||
649 | 1 | """ | ||
650 | 2 | This is the "gnome_constants" module. | ||
651 | 3 | |||
652 | 4 | The gnome_constants provides the "object map" to be used in gnome.py | ||
653 | 5 | """ | ||
654 | 6 | |||
655 | 7 | TOP_PANEL = 'frmTopExpandedEdgePanel' | ||
656 | 8 | |||
657 | 9 | |||
658 | 10 | # GtkSudo Popup (prefix = SU) | ||
659 | 11 | SU_WINDOW = "dlg0" | ||
660 | 12 | SU_TXT_PASS = "txtPassword" | ||
661 | 13 | SU_BTN_OK = "btnOK" | ||
662 | 14 | SU_BTN_CANCEL = "btnCancel" | ||
663 | 15 | |||
664 | 16 | # GEdit constants (prefix = GE) | ||
665 | 17 | GE_WINDOW = "frm*gedit" | ||
666 | 18 | GE_TXT_FIELD = "txt1" | ||
667 | 19 | GE_LAUNCHER = "gedit" | ||
668 | 20 | GE_SAVE_DLG = "dlgSave*" | ||
669 | 21 | GE_SAVE_DLG_TXT_NAME = "txtName" | ||
670 | 22 | GE_SAVE_DLG_BTN_SAVE = "btnSave" | ||
671 | 23 | GE_QUESTION_DLG = "dlgQuestion" | ||
672 | 24 | GE_QUESTION_DLG_BTN_SAVE = "btnSave" | ||
673 | 25 | GE_QUESTION_DLG_BTN_SAVE_AS = "btnSaveAs" | ||
674 | 26 | GE_QUESTION_DLG_BTN_CLOSE = "btnClosewithoutSaving" | ||
675 | 27 | GE_MNU_QUIT = "mnuQuit" | ||
676 | 28 | GE_MNU_CLOSE = "mnuClose" | ||
677 | 29 | GE_MNU_NEW = "mnuNew" | ||
678 | 30 | |||
679 | 31 | # Seahorse contants (prefix = SH) | ||
680 | 32 | SH_WINDOW = "frmPasswordsandEncryptionKeys" | ||
681 | 33 | SH_LAUNCHER = "seahorse" | ||
682 | 34 | SH_MNU_NEWKEY = "mnuNew" | ||
683 | 35 | SH_NEWKEY_DLG = "Create New ..." | ||
684 | 36 | SH_BTN_CONTINUE = "btnContinue" | ||
685 | 37 | SH_TYPE_PGP = "PGP Key" | ||
686 | 38 | SH_NEWPGP_DLG = "dlgCreateaPGPKey" | ||
687 | 39 | SH_DLG_NEWPGP_FULLNAME = "txtFullName" | ||
688 | 40 | SH_DLG_NEWPGP_EMAIL = "txtEmailAddress" | ||
689 | 41 | SH_DLG_NEWPGP_COMMENT = "txtComment" | ||
690 | 42 | SH_BTN_NEWPGP_CREATE = "btnCreate" | ||
691 | 43 | SH_DLG_NEWKEY_PASS = "dlgPassphrasefor*" | ||
692 | 44 | SH_BTN_PASS_OK = "btnOK" | ||
693 | 45 | SH_DLG_GENERATING_KEY = "dlgGeneratingkey" | ||
694 | 46 | SH_DLG_CREATING_SSH = "dlgCreatingSecureShellKey" | ||
695 | 47 | SH_TYPE_SSH = "Secure Shell Key" | ||
696 | 48 | SH_NEWSSH_DLG = "New Secure Shell Key" | ||
697 | 49 | SH_DLG_NEWSSH_DESC = "txtKeyDescription" | ||
698 | 50 | SH_BTN_NEWSSH_CREATE_AND_SETUP = "Create and Set Up" | ||
699 | 51 | SH_DLG_SET_UP = "Set Up Computer for SSH Connection" | ||
700 | 52 | SH_TXT_SET_UP_COMPUTER = "txtThehostnameoraddressoftheserver." | ||
701 | 53 | SH_TXT_SET_UP_LOGIN = "txtLoginName" | ||
702 | 54 | SH_BTN_SET_UP = "btnSetUp" | ||
703 | 55 | SH_BTN_NEWSSH_CREATE = "Just Create Key" | ||
704 | 56 | SH_TAB_PERSONAL_KEYS = "My Personal Keys" | ||
705 | 57 | SH_TAB_LIST = "ptl0" | ||
706 | 58 | |||
707 | 59 | 0 | ||
708 | === modified file 'desktoptesting/ubuntu.py' | |||
709 | --- desktoptesting/ubuntu.py 2009-03-25 10:23:04 +0000 | |||
710 | +++ desktoptesting/ubuntu.py 2009-03-30 10:11:44 +0000 | |||
711 | @@ -5,7 +5,6 @@ | |||
712 | 5 | """ | 5 | """ |
713 | 6 | import ooldtp | 6 | import ooldtp |
714 | 7 | import ldtp | 7 | import ldtp |
715 | 8 | import ubuntu_constants | ||
716 | 9 | from desktoptesting.gnome import Application, PolicyKit | 8 | from desktoptesting.gnome import Application, PolicyKit |
717 | 10 | import re | 9 | import re |
718 | 11 | 10 | ||
719 | @@ -13,6 +12,7 @@ | |||
720 | 13 | 12 | ||
721 | 14 | def setup(self): | 13 | def setup(self): |
722 | 15 | pass | 14 | pass |
723 | 15 | |||
724 | 16 | def teardown(self): | 16 | def teardown(self): |
725 | 17 | self.cleanup() | 17 | self.cleanup() |
726 | 18 | 18 | ||
727 | @@ -48,7 +48,7 @@ | |||
728 | 48 | 48 | ||
729 | 49 | """ | 49 | """ |
730 | 50 | 50 | ||
732 | 51 | topPanel = ooldtp.context(ubuntu_constants.TOP_PANEL) | 51 | topPanel = ooldtp.context(self.__class__.TOP_PANEL) |
733 | 52 | 52 | ||
734 | 53 | try: | 53 | try: |
735 | 54 | actualMenu = topPanel.getchild(menu_item_txt) | 54 | actualMenu = topPanel.getchild(menu_item_txt) |
736 | @@ -73,6 +73,22 @@ | |||
737 | 73 | 73 | ||
738 | 74 | i.e. C{updateManager = UpdateManager("my_password")} | 74 | i.e. C{updateManager = UpdateManager("my_password")} |
739 | 75 | """ | 75 | """ |
740 | 76 | MNU_ITEM = "mnuUpdateManager" | ||
741 | 77 | WINDOW = "frmUpdateManager" | ||
742 | 78 | LAUNCHER = "update-manager" | ||
743 | 79 | BTN_CLOSE = "btnClose" | ||
744 | 80 | BTN_CHECK = "btnCheck" | ||
745 | 81 | BTN_INSTALL = "btnInstallUpdates" | ||
746 | 82 | TBL_UPDATES = "updates" | ||
747 | 83 | BAN_LIST = " updates" | ||
748 | 84 | TAB_CHANGES = "Changes" | ||
749 | 85 | TXT_DESCRIPTION = "Description" | ||
750 | 86 | LBL_WAIT = "lblKeepyoursystemup-to-date" | ||
751 | 87 | LBL_UPTODATE = "lblYoursystemisup-to-date" | ||
752 | 88 | LBL_N_UPDATES = r'lblYoucaninstall(\d+)updates?' | ||
753 | 89 | LBL_DOWNLOADSIZE = r'lblDownloadsize((\d+)((\.)(\d+))?)(.*)' | ||
754 | 90 | |||
755 | 91 | |||
756 | 76 | 92 | ||
757 | 77 | def __init__(self, password = ""): | 93 | def __init__(self, password = ""): |
758 | 78 | """ | 94 | """ |
759 | @@ -87,7 +103,7 @@ | |||
760 | 87 | @param password: User's password for administrative tasks. | 103 | @param password: User's password for administrative tasks. |
761 | 88 | 104 | ||
762 | 89 | """ | 105 | """ |
764 | 90 | Application.__init__(self, ubuntu_constants.UM_WINDOW) | 106 | Application.__init__(self) |
765 | 91 | self.password = password | 107 | self.password = password |
766 | 92 | 108 | ||
767 | 93 | def setup(self): | 109 | def setup(self): |
768 | @@ -110,17 +126,17 @@ | |||
769 | 110 | """ | 126 | """ |
770 | 111 | 127 | ||
771 | 112 | if dist_upgrade: | 128 | if dist_upgrade: |
774 | 113 | ldtp.launchapp(ubuntu_constants.UM_LAUNCHER, ['-d'], 0) | 129 | ldtp.launchapp(self.__class__.LAUNCHER, ['-d'], 0) |
775 | 114 | response = ldtp.waittillguiexist(ubuntu_constants.UM_WINDOW, '', 20) | 130 | response = ldtp.waittillguiexist(self.name, '', 20) |
776 | 115 | 131 | ||
777 | 116 | if response == 0: | 132 | if response == 0: |
779 | 117 | raise ldtp.LdtpExecutionError, "The " + ubuntu_constants.UM_WINDOW + " window was not found." | 133 | raise ldtp.LdtpExecutionError, "The " + self.name + " window was not found." |
780 | 118 | 134 | ||
781 | 119 | else: | 135 | else: |
783 | 120 | self.open_and_check_app(ubuntu_constants.UM_LAUNCHER) | 136 | self.open_and_check_app() |
784 | 121 | 137 | ||
785 | 122 | # Wait the population of the list | 138 | # Wait the population of the list |
787 | 123 | updateManager = ooldtp.context(ubuntu_constants.UM_WINDOW) | 139 | updateManager = ooldtp.context(self.name) |
788 | 124 | 140 | ||
789 | 125 | populating = True | 141 | populating = True |
790 | 126 | 142 | ||
791 | @@ -132,7 +148,7 @@ | |||
792 | 132 | label = updateManager.getchild(role = 'label') | 148 | label = updateManager.getchild(role = 'label') |
793 | 133 | for i in label: | 149 | for i in label: |
794 | 134 | label_name = i.getName() | 150 | label_name = i.getName() |
796 | 135 | if label_name == ubuntu_constants.UM_LBL_WAIT: | 151 | if label_name == self.__class__.LBL_WAIT: |
797 | 136 | populating = True | 152 | populating = True |
798 | 137 | 153 | ||
799 | 138 | except ldtp.LdtpExecutionError: | 154 | except ldtp.LdtpExecutionError: |
800 | @@ -143,15 +159,15 @@ | |||
801 | 143 | It closes the update-manager window using the close button. | 159 | It closes the update-manager window using the close button. |
802 | 144 | """ | 160 | """ |
803 | 145 | 161 | ||
805 | 146 | updateManager = ooldtp.context(ubuntu_constants.UM_WINDOW) | 162 | updateManager = ooldtp.context(self.name) |
806 | 147 | 163 | ||
807 | 148 | try: | 164 | try: |
809 | 149 | closeButton = updateManager.getchild(ubuntu_constants.UM_BTN_CLOSE) | 165 | closeButton = updateManager.getchild(self.__class__.BTN_CLOSE) |
810 | 150 | except ldtp.LdtpExecutionError: | 166 | except ldtp.LdtpExecutionError: |
811 | 151 | raise ldtp.LdtpExecutionError, "The Update Manager Close button was not found." | 167 | raise ldtp.LdtpExecutionError, "The Update Manager Close button was not found." |
812 | 152 | 168 | ||
813 | 153 | closeButton.click() | 169 | closeButton.click() |
815 | 154 | ldtp.waittillguinotexist (ubuntu_constants.UM_WINDOW) | 170 | ldtp.waittillguinotexist (self.name) |
816 | 155 | 171 | ||
817 | 156 | def number_updates(self): | 172 | def number_updates(self): |
818 | 157 | """ | 173 | """ |
819 | @@ -161,16 +177,16 @@ | |||
820 | 161 | @return: An integer with the number of available updates. | 177 | @return: An integer with the number of available updates. |
821 | 162 | 178 | ||
822 | 163 | """ | 179 | """ |
824 | 164 | updateManager = ooldtp.context(ubuntu_constants.UM_WINDOW) | 180 | updateManager = ooldtp.context(self.name) |
825 | 165 | 181 | ||
826 | 166 | try: | 182 | try: |
827 | 167 | label = updateManager.getchild(role = 'label') | 183 | label = updateManager.getchild(role = 'label') |
828 | 168 | for i in label: | 184 | for i in label: |
829 | 169 | label_name = i.getName() | 185 | label_name = i.getName() |
831 | 170 | if label_name == ubuntu_constants.UM_LBL_UPTODATE: | 186 | if label_name == self.__class__.LBL_UPTODATE: |
832 | 171 | return 0 | 187 | return 0 |
833 | 172 | else: | 188 | else: |
835 | 173 | groups = re.match(ubuntu_constants.UM_LBL_N_UPDATES, label_name) | 189 | groups = re.match(self.__class__.LBL_N_UPDATES, label_name) |
836 | 174 | if groups: | 190 | if groups: |
837 | 175 | number = groups.group(1) | 191 | number = groups.group(1) |
838 | 176 | return int(number) | 192 | return int(number) |
839 | @@ -186,13 +202,13 @@ | |||
840 | 186 | 202 | ||
841 | 187 | @return: A float with the download size in bytes | 203 | @return: A float with the download size in bytes |
842 | 188 | """ | 204 | """ |
844 | 189 | updateManager = ooldtp.context(ubuntu_constants.UM_WINDOW) | 205 | updateManager = ooldtp.context(self.name) |
845 | 190 | 206 | ||
846 | 191 | try: | 207 | try: |
847 | 192 | label = updateManager.getchild(role = 'label') | 208 | label = updateManager.getchild(role = 'label') |
848 | 193 | for i in label: | 209 | for i in label: |
849 | 194 | label_name = i.getName() | 210 | label_name = i.getName() |
851 | 195 | groups = re.match(ubuntu_constants.UM_LBL_DOWNLOADSIZE, label_name) | 211 | groups = re.match(self.__class__.LBL_DOWNLOADSIZE, label_name) |
852 | 196 | 212 | ||
853 | 197 | if groups: | 213 | if groups: |
854 | 198 | # Calculate size based on the tag after the number | 214 | # Calculate size based on the tag after the number |
855 | @@ -220,10 +236,10 @@ | |||
856 | 220 | """ | 236 | """ |
857 | 221 | It selects all the available updates | 237 | It selects all the available updates |
858 | 222 | """ | 238 | """ |
860 | 223 | updateManager = ooldtp.context(ubuntu_constants.UM_WINDOW) | 239 | updateManager = ooldtp.context(self.name) |
861 | 224 | 240 | ||
862 | 225 | try: | 241 | try: |
864 | 226 | table = updateManager.getchild(ubuntu_constants.UM_TBL_UPDATES, role = 'table') | 242 | table = updateManager.getchild(self.__class__.TBL_UPDATES, role = 'table') |
865 | 227 | updates_table = table[0] | 243 | updates_table = table[0] |
866 | 228 | 244 | ||
867 | 229 | for i in range(0, updates_table.getrowcount(), 1): | 245 | for i in range(0, updates_table.getrowcount(), 1): |
868 | @@ -238,10 +254,10 @@ | |||
869 | 238 | """ | 254 | """ |
870 | 239 | It unselects all the available updates | 255 | It unselects all the available updates |
871 | 240 | """ | 256 | """ |
873 | 241 | updateManager = ooldtp.context(ubuntu_constants.UM_WINDOW) | 257 | updateManager = ooldtp.context(self.name) |
874 | 242 | 258 | ||
875 | 243 | try: | 259 | try: |
877 | 244 | table = updateManager.getchild(ubuntu_constants.UM_TBL_UPDATES, role = 'table') | 260 | table = updateManager.getchild(self.__class__.TBL_UPDATES, role = 'table') |
878 | 245 | updates_table = table[0] | 261 | updates_table = table[0] |
879 | 246 | 262 | ||
880 | 247 | # TODO: When table admits right click, use the context menu | 263 | # TODO: When table admits right click, use the context menu |
881 | @@ -266,18 +282,18 @@ | |||
882 | 266 | @return: A list with the available updates | 282 | @return: A list with the available updates |
883 | 267 | """ | 283 | """ |
884 | 268 | 284 | ||
886 | 269 | updateManager = ooldtp.context(ubuntu_constants.UM_WINDOW) | 285 | updateManager = ooldtp.context(self.name) |
887 | 270 | 286 | ||
888 | 271 | available_updates = [] | 287 | available_updates = [] |
889 | 272 | 288 | ||
890 | 273 | try: | 289 | try: |
892 | 274 | table = updateManager.getchild(ubuntu_constants.UM_TBL_UPDATES, role = 'table') | 290 | table = updateManager.getchild(self.__class__.TBL_UPDATES, role = 'table') |
893 | 275 | updates_table = table[0] | 291 | updates_table = table[0] |
894 | 276 | 292 | ||
895 | 277 | for i in range(0, updates_table.getrowcount(), 1): | 293 | for i in range(0, updates_table.getrowcount(), 1): |
896 | 278 | text = updates_table.getcellvalue(i, 1) | 294 | text = updates_table.getcellvalue(i, 1) |
897 | 279 | candidate = text.split('\n')[0] | 295 | candidate = text.split('\n')[0] |
899 | 280 | if candidate.find(ubuntu_constants.UM_BAN_LIST) == -1: | 296 | if candidate.find(self.__class__.BAN_LIST) == -1: |
900 | 281 | available_updates.append(candidate) | 297 | available_updates.append(candidate) |
901 | 282 | ldtp.wait(1) | 298 | ldtp.wait(1) |
902 | 283 | except ldtp.LdtpExecutionError: | 299 | except ldtp.LdtpExecutionError: |
903 | @@ -293,10 +309,10 @@ | |||
904 | 293 | @param name: The name of the package to select | 309 | @param name: The name of the package to select |
905 | 294 | """ | 310 | """ |
906 | 295 | 311 | ||
908 | 296 | updateManager = ooldtp.context(ubuntu_constants.UM_WINDOW) | 312 | updateManager = ooldtp.context(self.name) |
909 | 297 | 313 | ||
910 | 298 | try: | 314 | try: |
912 | 299 | table = updateManager.getchild(ubuntu_constants.UM_TBL_UPDATES, role = 'table') | 315 | table = updateManager.getchild(self.__class__.TBL_UPDATES, role = 'table') |
913 | 300 | updates_table = table[0] | 316 | updates_table = table[0] |
914 | 301 | 317 | ||
915 | 302 | for i in range(0, updates_table.getrowcount(), 1): | 318 | for i in range(0, updates_table.getrowcount(), 1): |
916 | @@ -317,10 +333,10 @@ | |||
917 | 317 | @param name: The name of the package to select | 333 | @param name: The name of the package to select |
918 | 318 | """ | 334 | """ |
919 | 319 | 335 | ||
921 | 320 | updateManager = ooldtp.context(ubuntu_constants.UM_WINDOW) | 336 | updateManager = ooldtp.context(self.name) |
922 | 321 | 337 | ||
923 | 322 | try: | 338 | try: |
925 | 323 | table = updateManager.getchild(ubuntu_constants.UM_TBL_UPDATES, role = 'table') | 339 | table = updateManager.getchild(self.__class__.TBL_UPDATES, role = 'table') |
926 | 324 | updates_table = table[0] | 340 | updates_table = table[0] |
927 | 325 | 341 | ||
928 | 326 | for i in range(0, updates_table.getrowcount(), 1): | 342 | for i in range(0, updates_table.getrowcount(), 1): |
929 | @@ -342,7 +358,7 @@ | |||
930 | 342 | """ | 358 | """ |
931 | 343 | 359 | ||
932 | 344 | try: | 360 | try: |
934 | 345 | updateManager = ooldtp.context(ubuntu_constants.UM_WINDOW) | 361 | updateManager = ooldtp.context(self.name) |
935 | 346 | except ldtp.LdtpExecutionError: | 362 | except ldtp.LdtpExecutionError: |
936 | 347 | raise ldtp.LdtpExecutionError, "The Update Manager window was not found." | 363 | raise ldtp.LdtpExecutionError, "The Update Manager window was not found." |
937 | 348 | 364 | ||
938 | @@ -354,7 +370,7 @@ | |||
939 | 354 | polKit = PolicyKit(self.password) | 370 | polKit = PolicyKit(self.password) |
940 | 355 | 371 | ||
941 | 356 | try: | 372 | try: |
943 | 357 | checkButton = updateManager.getchild(ubuntu_constants.UM_BTN_CHECK) | 373 | checkButton = updateManager.getchild(self.__class__.BTN_CHECK) |
944 | 358 | except ldtp.LdtpExecutionError: | 374 | except ldtp.LdtpExecutionError: |
945 | 359 | raise ldtp.LdtpExecutionError, "The Update Manager Check button was not found." | 375 | raise ldtp.LdtpExecutionError, "The Update Manager Check button was not found." |
946 | 360 | 376 | ||
947 | @@ -377,7 +393,7 @@ | |||
948 | 377 | """ | 393 | """ |
949 | 378 | 394 | ||
950 | 379 | try: | 395 | try: |
952 | 380 | updateManager = ooldtp.context(ubuntu_constants.UM_WINDOW) | 396 | updateManager = ooldtp.context(self.name) |
953 | 381 | except ldtp.LdtpExecutionError: | 397 | except ldtp.LdtpExecutionError: |
954 | 382 | raise ldtp.LdtpExecutionError, "The Update Manager window was not found." | 398 | raise ldtp.LdtpExecutionError, "The Update Manager window was not found." |
955 | 383 | 399 | ||
956 | @@ -385,7 +401,7 @@ | |||
957 | 385 | if self.number_updates() > 0: | 401 | if self.number_updates() > 0: |
958 | 386 | 402 | ||
959 | 387 | try: | 403 | try: |
961 | 388 | btnInstall = updateManager.getchild(ubuntu_constants.UM_BTN_INSTALL) | 404 | btnInstall = updateManager.getchild(self.__class__.BTN_INSTALL) |
962 | 389 | except ldtp.LdtpExecutionError: | 405 | except ldtp.LdtpExecutionError: |
963 | 390 | raise ldtp.LdtpExecutionError, "The Update Manager install button was not found." | 406 | raise ldtp.LdtpExecutionError, "The Update Manager install button was not found." |
964 | 391 | 407 | ||
965 | @@ -403,7 +419,7 @@ | |||
966 | 403 | 419 | ||
967 | 404 | # Wait for the the close button to be ready | 420 | # Wait for the the close button to be ready |
968 | 405 | try: | 421 | try: |
970 | 406 | btnClose = updateManager.getchild(ubuntu_constants.UM_BTN_CLOSE) | 422 | btnClose = updateManager.getchild(self.__class__.BTN_CLOSE) |
971 | 407 | except ldtp.LdtpExecutionError: | 423 | except ldtp.LdtpExecutionError: |
972 | 408 | raise ldtp.LdtpExecutionError, "The Update Manager Close button was not found." | 424 | raise ldtp.LdtpExecutionError, "The Update Manager Close button was not found." |
973 | 409 | 425 | ||
974 | @@ -418,12 +434,12 @@ | |||
975 | 418 | """ | 434 | """ |
976 | 419 | 435 | ||
977 | 420 | try: | 436 | try: |
979 | 421 | updateManager = ooldtp.context(ubuntu_constants.UM_WINDOW) | 437 | updateManager = ooldtp.context(self.name) |
980 | 422 | except ldtp.LdtpExecutionError: | 438 | except ldtp.LdtpExecutionError: |
981 | 423 | raise ldtp.LdtpExecutionError, "The Update Manager window was not found." | 439 | raise ldtp.LdtpExecutionError, "The Update Manager window was not found." |
982 | 424 | 440 | ||
983 | 425 | try: | 441 | try: |
985 | 426 | btnTest = updateManager.getchild(ubuntu_constants.UM_BTN_INSTALL) | 442 | btnTest = updateManager.getchild(self.__class__.BTN_INSTALL) |
986 | 427 | state = btnTest.stateenabled() | 443 | state = btnTest.stateenabled() |
987 | 428 | except ldtp.LdtpExecutionError: | 444 | except ldtp.LdtpExecutionError: |
988 | 429 | raise ldtp.LdtpExecutionError, "The install button was not found." | 445 | raise ldtp.LdtpExecutionError, "The install button was not found." |
989 | @@ -455,7 +471,7 @@ | |||
990 | 455 | @return: The decription of the packages, as shown in the application | 471 | @return: The decription of the packages, as shown in the application |
991 | 456 | """ | 472 | """ |
992 | 457 | try: | 473 | try: |
994 | 458 | updateManager = ooldtp.context(ubuntu_constants.UM_WINDOW) | 474 | updateManager = ooldtp.context(self.name) |
995 | 459 | except ldtp.LdtpExecutionError: | 475 | except ldtp.LdtpExecutionError: |
996 | 460 | raise ldtp.LdtpExecutionError, "The Update Manager window was not found." | 476 | raise ldtp.LdtpExecutionError, "The Update Manager window was not found." |
997 | 461 | 477 | ||
998 | @@ -464,9 +480,9 @@ | |||
999 | 464 | self.select_update(name) | 480 | self.select_update(name) |
1000 | 465 | 481 | ||
1001 | 466 | # Get the description text field | 482 | # Get the description text field |
1003 | 467 | text_field = updateManager.getchild(ubuntu_constants.UM_TXT_DESCRIPTION, role='text') | 483 | text_field = updateManager.getchild(self.__class__.TXT_DESCRIPTION, role='text') |
1004 | 468 | # Get the text | 484 | # Get the text |
1006 | 469 | text = ldtp.gettextvalue(ubuntu_constants.UM_WINDOW, text_field[0].getName()) | 485 | text = ldtp.gettextvalue(self.name, text_field[0].getName()) |
1007 | 470 | return text | 486 | return text |
1008 | 471 | except ldtp.LdtpExecutionError: | 487 | except ldtp.LdtpExecutionError: |
1009 | 472 | raise ldtp.LdtpExecutionError, "The description text was not found." | 488 | raise ldtp.LdtpExecutionError, "The description text was not found." |
1010 | @@ -486,7 +502,7 @@ | |||
1011 | 486 | @return: The decription of the changes | 502 | @return: The decription of the changes |
1012 | 487 | """ | 503 | """ |
1013 | 488 | try: | 504 | try: |
1015 | 489 | ooldtp.context(ubuntu_constants.UM_WINDOW) | 505 | ooldtp.context(self.name) |
1016 | 490 | except ldtp.LdtpExecutionError: | 506 | except ldtp.LdtpExecutionError: |
1017 | 491 | raise ldtp.LdtpExecutionError, "The Update Manager window was not found." | 507 | raise ldtp.LdtpExecutionError, "The Update Manager window was not found." |
1018 | 492 | 508 | ||
1019 | @@ -495,14 +511,14 @@ | |||
1020 | 495 | self.select_update(name) | 511 | self.select_update(name) |
1021 | 496 | 512 | ||
1022 | 497 | # Get the filler tab | 513 | # Get the filler tab |
1024 | 498 | filler = ldtp.getobjectproperty(ubuntu_constants.UM_WINDOW , ubuntu_constants.UM_TAB_CHANGES, 'children') | 514 | filler = ldtp.getobjectproperty(self.name , self.__class__.TAB_CHANGES, 'children') |
1025 | 499 | # Get the scroll pane | 515 | # Get the scroll pane |
1027 | 500 | scroll_pane = ldtp.getobjectproperty(ubuntu_constants.UM_WINDOW , filler, 'children') | 516 | scroll_pane = ldtp.getobjectproperty(self.name , filler, 'children') |
1028 | 501 | # Get the text field | 517 | # Get the text field |
1030 | 502 | text_field = ldtp.getobjectproperty(ubuntu_constants.UM_WINDOW , scroll_pane, 'children') | 518 | text_field = ldtp.getobjectproperty(self.name , scroll_pane, 'children') |
1031 | 503 | text_field = text_field.split(' ')[0] | 519 | text_field = text_field.split(' ')[0] |
1032 | 504 | # Get the text | 520 | # Get the text |
1034 | 505 | text = ldtp.gettextvalue(ubuntu_constants.UM_WINDOW, text_field) | 521 | text = ldtp.gettextvalue(self.name, text_field) |
1035 | 506 | return text | 522 | return text |
1036 | 507 | except ldtp.LdtpExecutionError: | 523 | except ldtp.LdtpExecutionError: |
1037 | 508 | raise ldtp.LdtpExecutionError, "The Changes tab was not found." | 524 | raise ldtp.LdtpExecutionError, "The Changes tab was not found." |
1038 | @@ -517,7 +533,7 @@ | |||
1039 | 517 | @param show: True, to show the description; False, to hide the description. | 533 | @param show: True, to show the description; False, to hide the description. |
1040 | 518 | """ | 534 | """ |
1041 | 519 | try: | 535 | try: |
1043 | 520 | updateManager = ooldtp.context(ubuntu_constants.UM_WINDOW) | 536 | updateManager = ooldtp.context(self.name) |
1044 | 521 | except ldtp.LdtpExecutionError: | 537 | except ldtp.LdtpExecutionError: |
1045 | 522 | raise ldtp.LdtpExecutionError, "The Update Manager window was not found." | 538 | raise ldtp.LdtpExecutionError, "The Update Manager window was not found." |
1046 | 523 | 539 | ||
1047 | @@ -531,5 +547,3 @@ | |||
1048 | 531 | raise ldtp.LdtpExecutionError, "The description button was not found." | 547 | raise ldtp.LdtpExecutionError, "The description button was not found." |
1049 | 532 | 548 | ||
1050 | 533 | return state | 549 | return state |
1051 | 534 | |||
1052 | 535 | |||
1053 | 536 | 550 | ||
1054 | === removed file 'desktoptesting/ubuntu_constants.py' | |||
1055 | --- desktoptesting/ubuntu_constants.py 2009-03-18 16:04:17 +0000 | |||
1056 | +++ desktoptesting/ubuntu_constants.py 1970-01-01 00:00:00 +0000 | |||
1057 | @@ -1,32 +0,0 @@ | |||
1058 | 1 | """ | ||
1059 | 2 | This is the "ubuntu_constants" module. | ||
1060 | 3 | |||
1061 | 4 | The ubuntu_constants provides the "object map" to be used in ubuntu.py | ||
1062 | 5 | """ | ||
1063 | 6 | |||
1064 | 7 | TOP_PANEL = 'frmTopExpandedEdgePanel' | ||
1065 | 8 | |||
1066 | 9 | |||
1067 | 10 | # Update Manager constants (prefix = UM) | ||
1068 | 11 | UM_MNU_ITEM = "mnuUpdateManager" | ||
1069 | 12 | UM_WINDOW = "frmUpdateManager" | ||
1070 | 13 | UM_LAUNCHER = "update-manager" | ||
1071 | 14 | UM_BTN_CLOSE = "btnClose" | ||
1072 | 15 | UM_BTN_CHECK = "btnCheck" | ||
1073 | 16 | UM_BTN_INSTALL = "btnInstallUpdates" | ||
1074 | 17 | UM_TBL_UPDATES = "updates" | ||
1075 | 18 | UM_BAN_LIST = " updates" | ||
1076 | 19 | UM_TAB_CHANGES = "Changes" | ||
1077 | 20 | UM_TXT_DESCRIPTION = "Description" | ||
1078 | 21 | UM_LBL_WAIT = "lblKeepyoursystemup-to-date" | ||
1079 | 22 | UM_LBL_UPTODATE = "lblYoursystemisup-to-date" | ||
1080 | 23 | UM_LBL_N_UPDATES = r'lblYoucaninstall(\d+)updates?' | ||
1081 | 24 | UM_LBL_DOWNLOADSIZE = r'lblDownloadsize((\d+)((\.)(\d+))?)(.*)' | ||
1082 | 25 | |||
1083 | 26 | # GtkSudo Popup (prefix = SU) | ||
1084 | 27 | SU_WINDOW = "dlg0" | ||
1085 | 28 | SU_TXT_PASS = "txtPassword" | ||
1086 | 29 | SU_BTN_OK = "btnOK" | ||
1087 | 30 | SU_BTN_CANCEL = "btnCancel" | ||
1088 | 31 | |||
1089 | 32 |
Constants moved from modules to classes to prevent name clashes from happening without adding prefixes to constant names.
Code takes advantage of using standard constants such as LAUNCHER, WINDOW, etc.