Merge lp:~dbarth/ubuntu-system-settings-online-accounts/fix-ap-test2 into lp:ubuntu-system-settings-online-accounts

Proposed by David Barth
Status: Superseded
Proposed branch: lp:~dbarth/ubuntu-system-settings-online-accounts/fix-ap-test2
Merge into: lp:ubuntu-system-settings-online-accounts
Diff against target: 570 lines (+103/-399)
4 files modified
debian/control (+1/-1)
debian/tests/autopilot (+6/-0)
debian/tests/control (+2/-0)
tests/autopilot/online_accounts_ui/tests/test_online_accounts_ui.py (+94/-398)
To merge this branch: bzr merge lp:~dbarth/ubuntu-system-settings-online-accounts/fix-ap-test2
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Alberto Mardegan (community) Approve
Review via email: mp+211547@code.launchpad.net

This proposal has been superseded by a proposal from 2014-03-19.

To post a comment you must log in.
Revision history for this message
Alberto Mardegan (mardy) wrote :

LGTM, thanks!

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

FAILED: Autolanding.
No commit message was specified in the merge proposal. Hit 'Add commit message' on the merge proposal web page or follow the link below. You can approve the merge proposal yourself to rerun.
https://code.launchpad.net/~dbarth/ubuntu-system-settings-online-accounts/fix-ap-test2/+merge/211547/+edit-commit-message

review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'debian/control'
--- debian/control 2014-03-06 13:36:34 +0000
+++ debian/control 2014-03-18 15:02:56 +0000
@@ -22,6 +22,7 @@
22# code again.22# code again.
23Vcs-Bzr: https://code.launchpad.net/~online-accounts/ubuntu-system-settings-online-accounts/trunk23Vcs-Bzr: https://code.launchpad.net/~online-accounts/ubuntu-system-settings-online-accounts/trunk
24X-Python-Version: 2.724X-Python-Version: 2.7
25XS-Testsuite: autopkgtest
2526
26Package: ubuntu-system-settings-online-accounts27Package: ubuntu-system-settings-online-accounts
27Architecture: any28Architecture: any
@@ -89,7 +90,6 @@
89 uoa-integration-tests,90 uoa-integration-tests,
90 libqt5test5,91 libqt5test5,
91 python-autopilot,92 python-autopilot,
92 python-oauth,
93Description: Online Accounts setup for Ubuntu Touch - tests93Description: Online Accounts setup for Ubuntu Touch - tests
94 Online Accounts setup utility for the Ubuntu Touch System Settings.94 Online Accounts setup utility for the Ubuntu Touch System Settings.
95 .95 .
9696
=== added directory 'debian/tests'
=== added file 'debian/tests/autopilot'
--- debian/tests/autopilot 1970-01-01 00:00:00 +0000
+++ debian/tests/autopilot 2014-03-18 15:02:56 +0000
@@ -0,0 +1,6 @@
1#!/bin/sh
2
3set -e
4
5autopilot run online_accounts_ui 2> /dev/null
6
07
=== added file 'debian/tests/control'
--- debian/tests/control 1970-01-01 00:00:00 +0000
+++ debian/tests/control 2014-03-18 15:02:56 +0000
@@ -0,0 +1,2 @@
1Tests: autopilot
2Depends: @
03
=== modified file 'tests/autopilot/online_accounts_ui/tests/test_online_accounts_ui.py'
--- tests/autopilot/online_accounts_ui/tests/test_online_accounts_ui.py 2014-03-06 13:36:34 +0000
+++ tests/autopilot/online_accounts_ui/tests/test_online_accounts_ui.py 2014-03-18 15:02:56 +0000
@@ -12,230 +12,22 @@
12from autopilot.input import Mouse, Touch, Pointer12from autopilot.input import Mouse, Touch, Pointer
13from autopilot.platform import model13from autopilot.platform import model
14from autopilot.matchers import Eventually14from autopilot.matchers import Eventually
15from subprocess import Popen
15from testtools.matchers import Contains, Equals, NotEquals, GreaterThan16from testtools.matchers import Contains, Equals, NotEquals, GreaterThan
16from time import sleep17from time import sleep
17import BaseHTTPServer, SimpleHTTPServer, SocketServer, ssl, cgi18import os
18import threading
19import oauth.oauth as oauth
2019
21from online_accounts_ui.emulators.items import EmulatorBase20from online_accounts_ui.emulators.items import EmulatorBase
2221
23REQUEST_TOKEN_URL = 'http://localhost:5121/oauth1/request_token'22
24ACCESS_TOKEN_URL = 'http://localhost:5121/oauth1/access_token'23# You can find a couple of OAuth 1.0a and 2.0 tests in the repository history
25AUTHORIZATION_URL = 'http://localhost:5121/oauth1/authorize'24# (bazaar revision 100).
26CALLBACK_URL = 'http://localhost:5121/success.html'25# These tests were removed because the signon-ui window where the webview is
27REALM = 'http://photos.example.net/'26# hosted will not be focused properly, both in Mir
28VERIFIER = 'verifier'27# (https://bugs.launchpad.net/bugs/1231968) and Compiz
2928# (https://bugs.launchpad.net/bugs/455241)
30class MockOAuthDataStore(oauth.OAuthDataStore):29# This issue will be solved when we move the signon-ui implementation in the
31 def __init__(self):30# same process as online-accounts-ui
32 self.consumer = oauth.OAuthConsumer('C0nsum3rKey', 'C0nsum3rS3cr3t')
33 self.request_token = oauth.OAuthToken('requestkey', 'requestsecret')
34 self.access_token = oauth.OAuthToken('accesskey', 'accesssecret')
35 self.nonce = 'nonce'
36 self.verifier = VERIFIER
37
38 def lookup_consumer(self, key):
39 if key == self.consumer.key:
40 return self.consumer
41 return None
42
43 def lookup_token(self, token_type, token):
44 token_attrib = getattr(self, '%s_token' % token_type)
45 if token == token_attrib.key:
46 ## HACK
47 token_attrib.set_callback(CALLBACK_URL)
48 return token_attrib
49 return None
50
51 def lookup_nonce(self, oauth_consumer, oauth_token, nonce):
52 if oauth_token and oauth_consumer.key == self.consumer.key and (oauth_token.key == self.request_token.key or oauth_token.key == self.access_token.key) and nonce == self.nonce:
53 return self.nonce
54 return None
55
56 def fetch_request_token(self, oauth_consumer, oauth_callback):
57 if oauth_consumer.key == self.consumer.key:
58 if oauth_callback:
59 # want to check here if callback is sensible
60 # for mock store, we assume it is
61 self.request_token.set_callback(oauth_callback)
62 return self.request_token
63 return None
64
65 def fetch_access_token(self, oauth_consumer, oauth_token, oauth_verifier):
66 if oauth_consumer.key == self.consumer.key and oauth_token.key == self.request_token.key and oauth_verifier == self.verifier:
67 # want to check here if token is authorized
68 # for mock store, we assume it is
69 return self.access_token
70 return None
71
72 def authorize_request_token(self, oauth_token, user):
73 if oauth_token.key == self.request_token.key:
74 # authorize the request token in the store
75 # for mock store, do nothing
76 self.access_token.username = user
77 return self.request_token
78 return None
79
80class OAuth1Handler(BaseHTTPServer.BaseHTTPRequestHandler):
81 def __init__(self, *args, **kwargs):
82 BaseHTTPServer.BaseHTTPRequestHandler.__init__(self, *args, **kwargs)
83
84 def do_HEAD(self):
85 self.send_response(200)
86 self.send_header("Content-type", "text/html")
87 s.end_headers()
88
89 def do_GET(self):
90 print "Got GET to %s. headers: %s" % (self.path, self.headers)
91 if self.path.startswith('/oauth1/authorize'):
92 oauth_request = oauth.OAuthRequest.from_request(self.command,
93 'http://localhost:%s%s' % (self.server.server_port, self.path),
94 headers=self.headers)
95 # get the request token
96 self.server.token = self.server.oauth_server.fetch_request_token(oauth_request)
97
98 self.send_response(200)
99 self.send_header("Content-type", "text/html")
100 self.send_header('Content-Encoding', 'utf-8')
101 self.end_headers()
102 self.wfile.write("""
103 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
104 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
105 <html xmlns="http://www.w3.org/1999/xhtml">
106 <head><title>Login here</title></head>
107 <body>
108 <h3>Login form</h3>
109 <form method="POST" action="http://localhost:%(port)s/login.html">
110 Username: <input type="text" name="username" size="15" /><br />
111 <p><input type="submit" value="Login" /></p>
112 </form>
113 </body>
114 </html>
115 """ % { 'port': self.server.server_port })
116 self.server.show_login_event.set()
117
118 def do_POST(self):
119 if self.path == '/login.html':
120 form = cgi.FieldStorage(
121 fp=self.rfile,
122 headers=self.headers,
123 environ={'REQUEST_METHOD':'POST',
124 'CONTENT_TYPE':self.headers['Content-Type'],
125 })
126 # authorize the token
127 token = self.server.oauth_server.authorize_token(self.server.token, form['username'].value)
128 token.set_verifier(VERIFIER)
129 self.send_response(301)
130 self.send_header("Location", token.get_callback_url())
131 self.end_headers()
132 self.server.login_done_event.set()
133 return
134
135 # construct the oauth request from the request parameters
136 length = int(self.headers.getheader('content-length'))
137 postdata = self.rfile.read(length)
138 oauth_request = oauth.OAuthRequest.from_request(self.command,
139 'http://localhost:%s%s' % (self.server.server_port, self.path),
140 headers=self.headers, query_string=postdata)
141
142 if self.path == '/oauth1/request_token':
143 # create a request token
144 token = self.server.oauth_server.fetch_request_token(oauth_request)
145 # send okay response
146 self.send_response(200, 'OK')
147 self.send_header('Content-Type', 'application/x-www-form-urlencoded')
148 self.end_headers()
149 # return the token
150 self.wfile.write(token.to_string())
151 elif self.path == '/oauth1/access_token':
152 # create an access token
153 token = self.server.oauth_server.fetch_access_token(oauth_request)
154 # send okay response
155 self.send_response(200, 'OK')
156 self.send_header('Content-Type', 'application/x-www-form-urlencoded')
157 self.end_headers()
158 # return the token
159 self.wfile.write('%s&ScreenName=%s' % (token.to_string(), token.username))
160
161
162class OAuth1LocalServer:
163 def __init__(self):
164 self.PORT = 5121
165 self.handler = OAuth1Handler
166 self.httpd = BaseHTTPServer.HTTPServer(('localhost', self.PORT), self.handler)
167 self.httpd.oauth_server = oauth.OAuthServer(MockOAuthDataStore())
168 self.httpd.oauth_server.add_signature_method(oauth.OAuthSignatureMethod_PLAINTEXT())
169 self.httpd.oauth_server.add_signature_method(oauth.OAuthSignatureMethod_HMAC_SHA1())
170 self.httpd.show_login_event = threading.Event()
171 self.httpd.login_done_event = threading.Event()
172 self.httpd_thread = threading.Thread(target=self.httpd.serve_forever)
173
174 def run(self):
175 self.httpd_thread.setDaemon(True)
176 self.httpd_thread.start()
177
178
179class Handler(BaseHTTPServer.BaseHTTPRequestHandler):
180 def do_HEAD(self):
181 self.send_response(200)
182 self.send_header("Content-type", "text/html")
183 s.end_headers()
184
185 def do_GET(self):
186 self.send_response(200)
187 self.send_header("Content-type", "text/html")
188 self.send_header('Content-Encoding', 'utf-8')
189 self.end_headers()
190 self.wfile.write("""
191<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
192 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
193<html xmlns="http://www.w3.org/1999/xhtml">
194<head><title>Login here</title></head>
195<body>
196<h3>Login form</h3>
197<form method="POST" action="https://localhost:%(port)s/login.html">
198 Username: <input type="text" name="username" size="15" /><br />
199 Password: <input type="password" name="password" size="15" /><br />
200 <p><input type="submit" value="Login" /></p>
201</form>
202</body>
203</html>
204""" % { 'port': self.server.server_port })
205 self.server.show_login_event.set()
206
207 def do_POST(self):
208 form = cgi.FieldStorage(
209 fp=self.rfile,
210 headers=self.headers,
211 environ={'REQUEST_METHOD':'POST',
212 'CONTENT_TYPE':self.headers['Content-Type'],
213 })
214 self.send_response(301)
215 self.send_header("Location",
216 "https://localhost:%(port)s/success.html#access_token=%(username)s%(password)s&expires_in=3600" % {
217 'port': self.server.server_port,
218 'username': form['username'].value,
219 'password': form['password'].value
220 })
221 self.end_headers()
222 self.server.login_done_event.set()
223
224
225class LocalServer:
226 def __init__(self):
227 self.PORT = 5120
228 #self.handler = SimpleHTTPServer.SimpleHTTPRequestHandler
229 self.handler = Handler
230 self.httpd = BaseHTTPServer.HTTPServer(("localhost", self.PORT), self.handler)
231 self.httpd.show_login_event = threading.Event()
232 self.httpd.login_done_event = threading.Event()
233 self.httpd.socket = ssl.wrap_socket (self.httpd.socket, certfile='/etc/ssl/certs/uoa-test-server.pem', server_side=True)
234 self.httpd_thread = threading.Thread(target=self.httpd.serve_forever)
235
236 def run(self):
237 self.httpd_thread.setDaemon(True)
238 self.httpd_thread.start()
23931
24032
241class OnlineAccountsUiTests(AutopilotTestCase):33class OnlineAccountsUiTests(AutopilotTestCase):
@@ -256,14 +48,27 @@
256 return48 return
25749
258 self.pointer = Pointer(self.input_device_class.create())50 self.pointer = Pointer(self.input_device_class.create())
259 self.app = self.launch_test_application('system-settings', 'online-accounts',51 # Increase the timeout of online-accounts-ui, to make sure it won't
260 '--desktop_file_hint=/usr/share/applications/ubuntu-system-settings.desktop',52 # quit before the system settings panel asks it to open.
53 self.patch_environment('OAU_DAEMON_TIMEOUT', '120')
54 self.app = self.launch_test_application('online-accounts-ui',
55 '--desktop_file_hint=/usr/share/applications/online-accounts-ui.desktop',
261 app_type='qt',56 app_type='qt',
262 emulator_base=EmulatorBase,57 emulator_base=EmulatorBase,
263 capture_output=True)58 capture_output=True)
59 self.system_settings = Popen(['system-settings', 'online-accounts',
60 '--desktop_file_hint=/usr/share/applications/ubuntu-system-settings.desktop'])
61 sleep(1)
264 self.window = self.app.select_single("QQuickView")62 self.window = self.app.select_single("QQuickView")
265 self.assertThat(self.window.visible, Eventually(Equals(True)))63 self.assertThat(self.window.visible, Eventually(Equals(True)))
26664
65 def tearDown(self):
66 super(OnlineAccountsUiTests, self).tearDown()
67 # This matches the logic in setUp()
68 if model() != 'Desktop':
69 return
70 self.system_settings.terminate()
71
267 def test_title(self):72 def test_title(self):
268 """ Checks whether the Online Accounts window title is correct """73 """ Checks whether the Online Accounts window title is correct """
269 # On the phone, this fails because of https://bugs.launchpad.net/bugs/125229474 # On the phone, this fails because of https://bugs.launchpad.net/bugs/1252294
@@ -272,7 +77,7 @@
27277
273 header = self.window.select_single('Header', visible=True)78 header = self.window.select_single('Header', visible=True)
274 self.assertThat(header, NotEquals(None))79 self.assertThat(header, NotEquals(None))
275 self.assertThat(header.title, Eventually(Equals('Accounts')))80 self.assertThat(header.title, Eventually(Equals('Online Accounts')))
27681
277 def test_available_providers(self):82 def test_available_providers(self):
278 """ Checks whether all the expected providers are available """83 """ Checks whether all the expected providers are available """
@@ -287,179 +92,70 @@
287 provider_item = self.app.select_single('Standard', text=provider)92 provider_item = self.app.select_single('Standard', text=provider)
288 self.assertThat(provider_item, NotEquals(None))93 self.assertThat(provider_item, NotEquals(None))
28994
290 def test_create_oauth1_account(self):95 def test_create_account_with_form(self):
291 """ Test the creation of an OAuth 1.0 account """96 """ Test the creation of an account using a username/password form"""
292 # On the phone, this fails because of https://bugs.launchpad.net/bugs/123196897 # On the phone, this fails because of https://bugs.launchpad.net/bugs/1252294
293 if model() != 'Desktop':98 if model() != 'Desktop':
294 return99 return
295 server = OAuth1LocalServer()100 page = self.app.select_single('NoAccountsPage')
296 server.run()101 self.assertThat(page, NotEquals(None))
297102
298 page = self.app.select_single('NoAccountsPage')103 provider_item = self.app.select_single('Standard', text='TestLogin')
299 self.assertThat(page, NotEquals(None))104 self.assertThat(provider_item, NotEquals(None))
300105
301 provider_item = self.app.select_single('Standard', text='FakeOAuthOne')106 # Depending on the number of installed providers, it may be that our
302 self.assertThat(provider_item, NotEquals(None))107 # test provider is not visible; in that case, scroll the page
303108 self.pointer.move_to_object(page)
304 # Depending on the number of installed providers, it may be that our109 (page_center_x, page_center_y) = self.pointer.position()
305 # test provider is not visible; in that case, scroll the page110 page_bottom = page.globalRect[1] + page.globalRect[3]
306 self.pointer.move_to_object(page)111 while provider_item.center[1] > page_bottom - 20:
307 (page_center_x, page_center_y) = self.pointer.position()112 self.pointer.move(page_center_x, page_center_y)
308 page_bottom = page.globalRect[1] + page.globalRect[3]113 self.pointer.press()
309 while provider_item.center[1] > page_bottom:114 self.pointer.move(page_center_x, page_center_y - provider_item.height * 2)
310 self.pointer.move(page_center_x, page_center_y)115 # wait some time before releasing, to avoid a flick
311 self.pointer.press()116 sleep(0.2)
312 self.pointer.move(page_center_x, page_center_y - provider_item.height * 2)117 self.pointer.release()
313 # wait some time before releasing, to avoid a flick118 self.pointer.move_to_object(provider_item)
314 sleep(0.2)119 self.pointer.click()
315 self.pointer.release()120
316 self.pointer.move_to_object(provider_item)121 # Move to the username field
317 self.pointer.click()122 username_field = self.app.select_single('TextField', objectName='usernameField')
318123 self.pointer.move_to_object(username_field)
319 # At this point, the signon-ui process should be spawned by D-Bus and124 self.pointer.click()
320 # try to connect to our local webserver.125 self.keyboard.type('pinkuser')
321 # Here we wait until we know that the webserver has served the login page:126 self.keyboard.press_and_release('Tab')
322 server.httpd.show_login_event.wait(30)127 self.keyboard.type('lolcat')
323 self.assertThat(server.httpd.show_login_event.is_set(), Equals(True))128 # Submit
324 server.httpd.show_login_event.clear()129 continue_btn = self.app.select_single('Button', objectName='continueButton')
325130 self.pointer.move_to_object(continue_btn)
326 # Give some time to signon-ui to render the page131 self.pointer.click()
327 sleep(2)132
328 #self.signon_ui_window = self.signon_ui.select_single("QQuickView")133 # The account should be created shortly
329 #self.assertThat(self.signon_ui_window.visible, Eventually(Equals(True)))134 sleep(5)
330135 account_item = self.app.select_single('AccountItem', text='TestLogin')
331 # Move to the username field136 self.assertThat(account_item, NotEquals(None))
332 self.keyboard.press_and_release('Tab')137 self.assertThat(account_item.subText, Equals('pinkuser'))
333 self.keyboard.type('funnyguy')138
334 self.keyboard.press_and_release('Enter')139 # Delete it
335140 self.pointer.move_to_object(account_item)
336 # At this point signon-ui should make a post request with the login141 self.pointer.click()
337 # data; let's wait for it:142
338 server.httpd.login_done_event.wait(30)143 sleep(1)
339 self.assertThat(server.httpd.login_done_event.is_set(), Equals(True))144 edit_page = self.app.select_single('AccountEditPage')
340 server.httpd.login_done_event.clear()145 self.assertThat(edit_page, NotEquals(None))
341146 remove_button = edit_page.select_single('Button')
342 if model() == 'Desktop':147 self.assertThat(remove_button, NotEquals(None))
343 # Close the signon-ui window148 self.pointer.move_to_object(remove_button)
344 self.keyboard.press_and_release('Enter')149 self.pointer.click()
345150
346 # The account should be created shortly151 sleep(1)
347 sleep(5)152 removal_page = self.app.select_single('RemovalConfirmation')
348 account_item = self.app.select_single('AccountItem', text='FakeOAuthOne')153 self.assertThat(removal_page, NotEquals(None))
349 self.assertThat(account_item, NotEquals(None))154 remove_button = removal_page.select_single('Button', text='Remove')
350 self.assertThat(account_item.subText, Equals('funnyguy'))155 self.assertThat(remove_button, NotEquals(None))
351156 self.pointer.move_to_object(remove_button)
352 # Delete it157 self.pointer.click()
353 self.pointer.move_to_object(account_item)158
354 self.pointer.click()159 # Check that the account has been deleted
355160 account_item.wait_until_destroyed()
356 sleep(1)161
357 edit_page = self.app.select_single('AccountEditPage')
358 self.assertThat(edit_page, NotEquals(None))
359 remove_button = edit_page.select_single('Button')
360 self.assertThat(remove_button, NotEquals(None))
361 self.pointer.move_to_object(remove_button)
362 self.pointer.click()
363
364 sleep(1)
365 removal_page = self.app.select_single('RemovalConfirmation')
366 self.assertThat(removal_page, NotEquals(None))
367 remove_button = removal_page.select_single('Button', text='Remove')
368 self.assertThat(remove_button, NotEquals(None))
369 self.pointer.move_to_object(remove_button)
370 self.pointer.click()
371
372 # Check that the account has been deleted
373 sleep(1)
374 account_item = self.app.select_single('AccountItem', text='FakeOAuth')
375 self.assertThat(account_item, Equals(None))
376
377 def test_create_oauth2_account(self):
378 """ Test the creation of an OAuth 2.0 account """
379 # WebKit2 cannot ignore SSL errors, so this test fails on the phone
380 if model() != 'Desktop':
381 return
382
383 self.server = LocalServer()
384 self.server.run()
385
386 page = self.app.select_single('NoAccountsPage')
387 self.assertThat(page, NotEquals(None))
388
389 provider_item = self.app.select_single('Standard', text='FakeOAuth')
390 self.assertThat(provider_item, NotEquals(None))
391
392 # Depending on the number of installed providers, it may be that our
393 # test provider is not visible; in that case, scroll the page
394 self.pointer.move_to_object(page)
395 (page_center_x, page_center_y) = self.pointer.position()
396 page_bottom = page.globalRect[1] + page.globalRect[3]
397 while provider_item.center[1] > page_bottom:
398 self.pointer.move(page_center_x, page_center_y)
399 self.pointer.press()
400 self.pointer.move(page_center_x, page_center_y - provider_item.height * 2)
401 # wait some time before releasing, to avoid a flick
402 sleep(0.2)
403 self.pointer.release()
404 self.pointer.move_to_object(provider_item)
405 self.pointer.click()
406
407 # At this point, the signon-ui process should be spawned by D-Bus and
408 # try to connect to our local webserver.
409 # Here we wait until we know that the webserver has served the login page:
410 self.server.httpd.show_login_event.wait(30)
411 self.assertThat(self.server.httpd.show_login_event.is_set(), Equals(True))
412 self.server.httpd.show_login_event.clear()
413
414 # Give some time to signon-ui to render the page
415 sleep(2)
416 #self.signon_ui_window = self.signon_ui.select_single("QQuickView")
417 #self.assertThat(self.signon_ui_window.visible, Eventually(Equals(True)))
418
419 # Move to the username field
420 self.keyboard.press_and_release('Tab')
421 self.keyboard.type('john')
422 self.keyboard.press_and_release('Tab')
423 self.keyboard.type('loser')
424 self.keyboard.press_and_release('Enter')
425
426 # At this point signon-ui should make a post request with the login
427 # data; let's wait for it:
428 self.server.httpd.login_done_event.wait(30)
429 self.assertThat(self.server.httpd.login_done_event.is_set(), Equals(True))
430 self.server.httpd.login_done_event.clear()
431
432 if model() == 'Desktop':
433 # Close the signon-ui window
434 self.keyboard.press_and_release('Enter')
435
436 # The account should be created shortly
437 sleep(5)
438 account_item = self.app.select_single('AccountItem', text='FakeOAuth')
439 self.assertThat(account_item, NotEquals(None))
440 self.assertThat(account_item.subText, Equals('john'))
441
442 # Delete it
443 self.pointer.move_to_object(account_item)
444 self.pointer.click()
445
446 sleep(1)
447 edit_page = self.app.select_single('AccountEditPage')
448 self.assertThat(edit_page, NotEquals(None))
449 remove_button = edit_page.select_single('Button')
450 self.assertThat(remove_button, NotEquals(None))
451 self.pointer.move_to_object(remove_button)
452 self.pointer.click()
453
454 sleep(1)
455 removal_page = self.app.select_single('RemovalConfirmation')
456 self.assertThat(removal_page, NotEquals(None))
457 remove_button = removal_page.select_single('Button', text='Remove')
458 self.assertThat(remove_button, NotEquals(None))
459 self.pointer.move_to_object(remove_button)
460 self.pointer.click()
461
462 # Check that the account has been deleted
463 sleep(1)
464 account_item = self.app.select_single('AccountItem', text='FakeOAuth')
465 self.assertThat(account_item, Equals(None))

Subscribers

People subscribed via source and target branches