Merge lp:~elopio/unity-scope-click/install_without_account into lp:unity-scope-click

Proposed by Leo Arias
Status: Merged
Approved by: Leo Arias
Approved revision: 114
Merged at revision: 114
Proposed branch: lp:~elopio/unity-scope-click/install_without_account
Merge into: lp:unity-scope-click
Diff against target: 104 lines (+48/-13)
2 files modified
src/tests/autopilot/unityclickscope/fake_servers.py (+8/-4)
src/tests/autopilot/unityclickscope/test_click_scope.py (+40/-9)
To merge this branch: bzr merge lp:~elopio/unity-scope-click/install_without_account
Reviewer Review Type Date Requested Status
Roberto Alsina (community) Approve
PS Jenkins bot continuous-integration Approve
Richard Huddie Pending
Javier Collado Pending
VĂ­ctor R. Ruiz Pending
Review via email: mp+202783@code.launchpad.net

Commit message

Added a test to try to install without credentials.

To post a comment you must log in.
114. By Leo Arias

Refactor.

Revision history for this message
Leo Arias (elopio) wrote :

For this branch, we assume online accounts doesn't have U1 credentials. On the next one, I'm adding credentials creation and deletion.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Roberto Alsina (ralsina) wrote :

+1

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/tests/autopilot/unityclickscope/fake_servers.py'
2--- src/tests/autopilot/unityclickscope/fake_servers.py 2014-01-14 19:57:00 +0000
3+++ src/tests/autopilot/unityclickscope/fake_servers.py 2014-01-23 02:35:29 +0000
4@@ -42,10 +42,10 @@
5 ]
6 _FAKE_SHORTS_DETAILS_DICT = {
7 'website': 'https://launchpad.net/ubuntu-rssreader-app',
8- 'description':
9+ 'description': (
10 'Shorts is an rssreader application\n'
11 'Shorts is an rss reader application that allows you to easily '
12- 'search for new feeds.',
13+ 'search for new feeds.'),
14 'price': 0.0,
15 'framework': ["ubuntu-sdk-13.10"],
16 'terms_of_service': '',
17@@ -72,6 +72,9 @@
18 ],
19 'architecture': ['all']
20 }
21+ _FAKE_DETAILS = {
22+ 'com.ubuntu.shorts': _FAKE_SHORTS_DETAILS_DICT
23+ }
24
25 def do_GET(self):
26 parsed_path = urlparse.urlparse(self.path)
27@@ -107,8 +110,9 @@
28 self.wfile.write(data)
29
30 def send_package_details(self, package):
31- if package == 'com.ubuntu.shorts':
32+ details = self._FAKE_DETAILS.get(package, None)
33+ if details is not None:
34 self.send_json_reply(
35- 200, json.dumps(self._FAKE_SHORTS_DETAILS_DICT))
36+ 200, json.dumps(details))
37 else:
38 raise NotImplementedError(package)
39
40=== modified file 'src/tests/autopilot/unityclickscope/test_click_scope.py'
41--- src/tests/autopilot/unityclickscope/test_click_scope.py 2014-01-14 20:10:12 +0000
42+++ src/tests/autopilot/unityclickscope/test_click_scope.py 2014-01-23 02:35:29 +0000
43@@ -117,21 +117,52 @@
44 icon = self.scope.wait_select_single('Tile', text=name)
45 pointing_device = toolkit_emulators.get_pointing_device()
46 pointing_device.click_object(icon)
47- return self.dash.wait_select_single(AppPreview)
48-
49-
50-# TODO move this to unity. --elopio - 2014-1-14
51-class AppPreview(unity_emulators.UnityEmulatorBase):
52- """Autopilot emulator for the application preview."""
53+ preview = self.dash.wait_select_single(AppPreview)
54+ preview.showProcessingAction.wait_for(False)
55+ return preview
56+
57+ def test_install_without_credentials(self):
58+ preview = self._open_app_preview('Shorts')
59+ preview.install()
60+ error = self.dash.wait_select_single(DashPreview)
61+ details = error.get_details()
62+ self.assertEqual('Login Error', details.get('title'))
63+
64+
65+class Preview(object):
66
67 def get_details(self):
68- """Return the details of the application whose preview is open."""
69+ """Return the details of the open preview."""
70 title = self.select_single('Label', objectName='titleLabel').text
71- publisher = self.select_single(
72+ subtitle = self.select_single(
73 'Label', objectName='subtitleLabel').text
74 # The description label doesn't have an object name. Reported as bug
75 # http://pad.lv/1269114 -- elopio - 2014-1-14
76 # description = self.select_single(
77 # 'Label', objectName='descriptionLabel').text
78 # TODO check screenshots, icon, rating and reviews.
79- return dict(title=title, publisher=publisher)
80+ return dict(title=title, subtitle=subtitle)
81+
82+
83+# TODO move this to unity. --elopio - 2014-1-22
84+class DashPreview(unity_emulators.UnityEmulatorBase, Preview):
85+ """Autopilot emulator for the generic preview."""
86+
87+
88+# TODO move this to unity. --elopio - 2014-1-14
89+class AppPreview(unity_emulators.UnityEmulatorBase, Preview):
90+ """Autopilot emulator for the application preview."""
91+
92+ def get_details(self):
93+ """Return the details of the application whose preview is open."""
94+ details = super(AppPreview, self).get_details()
95+ return dict(
96+ title=details.get('title'), publisher=details.get('subtitle'))
97+
98+ def install(self):
99+ install_button = self.select_single('Button', objectName='button0')
100+ if install_button.text != 'Install':
101+ raise unity_emulators.UnityEmulatorException(
102+ 'Install button not found.')
103+ self.pointing_device.click_object(install_button)
104+ self.wait_until_destroyed()

Subscribers

People subscribed via source and target branches

to all changes: