Merge lp:~mago-contributors/mago/seahorse_revert into lp:~mago-contributors/mago/mago-1.0

Proposed by Eitan Isaacson
Status: Merged
Merged at revision: not available
Proposed branch: lp:~mago-contributors/mago/seahorse_revert
Merge into: lp:~mago-contributors/mago/mago-1.0
Diff against target: None lines
To merge this branch: bzr merge lp:~mago-contributors/mago/seahorse_revert
Reviewer Review Type Date Requested Status
Ara Pulido Approve
Review via email: mp+8232@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Eitan Isaacson (eeejay) wrote :

I made changes Ara suggested, specifically factor out the key removal to Application methods, this allows the optional use of these methods with the suite's teardown or cleanup methods.

Revision history for this message
Ara Pulido (ara) wrote :

A couple of comments:

First a syntax error: in line 23 of the diff, you wrote:
self.generated_keys.append(' ',join([full_name, email, comment]))

the comma should be a period, it is giving a syntax error.

Second, I think it would be better to keep the label names like "lblOneormoreofthedeletedkeysareprivatekeys" as constants on the top of the python module, to follow the mago process.

Thanks,
Ara.

review: Needs Fixing
94. By Eitan Isaacson

Fixed syntax error with join(). Made delete key question label a class attribute.

Revision history for this message
Eitan Isaacson (eeejay) wrote :

The issues you raised are fixed in the branch. Does the PGP case run for you? I am still having issues with it. That is why I missed the join() syntax error.

Please re-review.

95. By Ara Pulido

Fixed generate PGP assertion and deletion

Revision history for this message
Ara Pulido (ara) wrote :

I had to make a couple of changes to generate_pgp to test to make it work. But now it is up and working.

Merging it to trunk.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'mago/application/gnome.py'
2--- mago/application/gnome.py 2009-06-29 18:15:55 +0000
3+++ mago/application/gnome.py 2009-07-05 09:56:31 +0000
4@@ -37,11 +37,12 @@
5 BTN_NEWSSH_CREATE = "Just Create Key"
6 TAB_PERSONAL_KEYS = "My Personal Keys"
7 TAB_LIST = "ptl0"
8+ TBL_PERSONAL_KEYS = "tbl0"
9
10
11 def __init__(self):
12 Application.__init__(self)
13-
14+ self.generated_keys = []
15
16 def new_key(self, key_type):
17 """
18@@ -188,6 +189,8 @@
19 except ldtp.LdtpExecutionError:
20 raise ldtp.LdtpExecutionError, "The new pgp generating key dialog was not found."
21
22+ # Add key name to generated key list, so we know to delete it later.
23+ self.generated_keys.append(' ',join([full_name, email, comment]))
24
25 def new_ssh_key(self, description, passphrase, set_up = False, computer = '', login = ''):
26 """
27@@ -312,10 +315,21 @@
28
29 except ldtp.LdtpExecutionError:
30 raise ldtp.LdtpExecutionError, "The creating key dialog was not found."
31-
32+ # Add key name to generated key list, so we know to delete it later.
33+ self.generated_keys.append(description)
34+
35 # It is too fast to grab the main window afterwards
36 ldtp.wait(3)
37
38+ def go_to_tab(self, tab_name):
39+ """
40+ Go to the specified tab.
41+ """
42+ seahorse = ooldtp.context(self.name)
43+ page_list = seahorse.getchild(self.TAB_LIST)
44+ page_list.selecttab(self.TAB_PERSONAL_KEYS)
45+
46+
47 def assert_exists_key(self, name, tab_name = None):
48 """
49 It checks that the KEY with description 'description' is
50@@ -330,25 +344,48 @@
51 if not tab_name:
52 tab_name = self.TAB_PERSONAL_KEYS
53
54- seahorse = ooldtp.context(self.name)
55+ self.go_to_tab(tab_name)
56+ seahorse = ooldtp.context(self.name)
57+ return bool(seahorse.doesrowexist(self.TBL_PERSONAL_KEYS, name))
58+
59+ def remove_key(self, key):
60+ seahorse = ooldtp.context(self.name)
61+
62+ tbl_personal_keys = seahorse.getchild(self.TBL_PERSONAL_KEYS)
63+ mnu_delete = seahorse.getchild('mnuDelete')
64+ dlg_question = ooldtp.context('dlgQuestion')
65+
66 try:
67-
68- page_list = seahorse.getchild(self.TAB_LIST)
69- page_list.selecttab(self.TAB_PERSONAL_KEYS)
70- scroll_pane = ldtp.getobjectproperty(self.name, tab_name, 'children')
71- list_keys = ldtp.getobjectproperty(self.name, scroll_pane, 'children')
72- list_keys = list_keys.split(' ')[0]
73- list_keys = seahorse.getchild(list_keys)
74- for i in range(0, list_keys.getrowcount()):
75- current = list_keys.getcellvalue(i, 1)
76- if name in current:
77- return True
78-
79+ tbl_personal_keys.selectrow(key)
80+ except ldtp.LdtpExecutionError:
81+ # Doesn't exist, return False.
82 return False
83
84- except ldtp.LdtpExecutionError:
85- raise ldtp.LdtpExecutionError, "Error retrieving the list of keys."
86-
87+ mnu_delete.selectmenuitem()
88+ # General 'private key' verification.
89+ dlg_question.waittillguiexist(
90+ "lblOneormoreofthedeletedkeysareprivatekeys."
91+ "Areyousureyouwanttoproceed?")
92+ dlg_question.click('btnDelete')
93+ dlg_question.waittillguinotexist(
94+ "lblOneormoreofthedeletedkeysareprivatekeys."
95+ "Areyousureyouwanttoproceed?")
96+
97+ # Specific key type verification.
98+ dlg_question.waittillguiexist()
99+ dlg_question.click('btnDelete')
100+ dlg_question.waittillguinotexist()
101+
102+ return True
103+
104+ def remove_keys(self, keys=None, tab_name=None):
105+ self.go_to_tab(tab_name or self.TAB_PERSONAL_KEYS)
106+
107+ keys = keys or self.generated_keys
108+
109+ for key in keys:
110+ self.remove_key(key)
111+
112 class GEdit(Application):
113 """
114 GEdit manages the Gedit application.
115
116=== modified file 'seahorse/generate_pgp.py'
117--- seahorse/generate_pgp.py 2009-06-23 13:26:34 +0000
118+++ seahorse/generate_pgp.py 2009-07-05 09:56:31 +0000
119@@ -7,3 +7,8 @@
120
121 if self.application.assert_exists_key(name) == False:
122 raise AssertionError, "The key was not succesfully created."
123+
124+ def teardown(self):
125+ self.application.remove_keys()
126+ SeahorseTestSuite.teardown(self)
127+
128
129=== modified file 'seahorse/generate_ssh.py'
130--- seahorse/generate_ssh.py 2009-06-23 13:26:34 +0000
131+++ seahorse/generate_ssh.py 2009-07-05 09:56:31 +0000
132@@ -8,3 +8,7 @@
133 # Check that the key was successfully created
134 if self.application.assert_exists_key(description) == False:
135 raise AssertionError, "The key was not succesfully created."
136+
137+ def teardown(self):
138+ self.application.remove_keys()
139+ SeahorseTestSuite.teardown(self)

Subscribers

People subscribed via source and target branches

to status/vote changes: