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
=== modified file 'src/tests/autopilot/unityclickscope/fake_servers.py'
--- src/tests/autopilot/unityclickscope/fake_servers.py 2014-01-14 19:57:00 +0000
+++ src/tests/autopilot/unityclickscope/fake_servers.py 2014-01-23 02:35:29 +0000
@@ -42,10 +42,10 @@
42 ]42 ]
43 _FAKE_SHORTS_DETAILS_DICT = {43 _FAKE_SHORTS_DETAILS_DICT = {
44 'website': 'https://launchpad.net/ubuntu-rssreader-app',44 'website': 'https://launchpad.net/ubuntu-rssreader-app',
45 'description':45 'description': (
46 'Shorts is an rssreader application\n'46 'Shorts is an rssreader application\n'
47 'Shorts is an rss reader application that allows you to easily '47 'Shorts is an rss reader application that allows you to easily '
48 'search for new feeds.',48 'search for new feeds.'),
49 'price': 0.0,49 'price': 0.0,
50 'framework': ["ubuntu-sdk-13.10"],50 'framework': ["ubuntu-sdk-13.10"],
51 'terms_of_service': '',51 'terms_of_service': '',
@@ -72,6 +72,9 @@
72 ],72 ],
73 'architecture': ['all']73 'architecture': ['all']
74 }74 }
75 _FAKE_DETAILS = {
76 'com.ubuntu.shorts': _FAKE_SHORTS_DETAILS_DICT
77 }
7578
76 def do_GET(self):79 def do_GET(self):
77 parsed_path = urlparse.urlparse(self.path)80 parsed_path = urlparse.urlparse(self.path)
@@ -107,8 +110,9 @@
107 self.wfile.write(data)110 self.wfile.write(data)
108111
109 def send_package_details(self, package):112 def send_package_details(self, package):
110 if package == 'com.ubuntu.shorts':113 details = self._FAKE_DETAILS.get(package, None)
114 if details is not None:
111 self.send_json_reply(115 self.send_json_reply(
112 200, json.dumps(self._FAKE_SHORTS_DETAILS_DICT))116 200, json.dumps(details))
113 else:117 else:
114 raise NotImplementedError(package)118 raise NotImplementedError(package)
115119
=== modified file 'src/tests/autopilot/unityclickscope/test_click_scope.py'
--- src/tests/autopilot/unityclickscope/test_click_scope.py 2014-01-14 20:10:12 +0000
+++ src/tests/autopilot/unityclickscope/test_click_scope.py 2014-01-23 02:35:29 +0000
@@ -117,21 +117,52 @@
117 icon = self.scope.wait_select_single('Tile', text=name)117 icon = self.scope.wait_select_single('Tile', text=name)
118 pointing_device = toolkit_emulators.get_pointing_device()118 pointing_device = toolkit_emulators.get_pointing_device()
119 pointing_device.click_object(icon)119 pointing_device.click_object(icon)
120 return self.dash.wait_select_single(AppPreview)120 preview = self.dash.wait_select_single(AppPreview)
121121 preview.showProcessingAction.wait_for(False)
122122 return preview
123# TODO move this to unity. --elopio - 2014-1-14123
124class AppPreview(unity_emulators.UnityEmulatorBase):124 def test_install_without_credentials(self):
125 """Autopilot emulator for the application preview."""125 preview = self._open_app_preview('Shorts')
126 preview.install()
127 error = self.dash.wait_select_single(DashPreview)
128 details = error.get_details()
129 self.assertEqual('Login Error', details.get('title'))
130
131
132class Preview(object):
126133
127 def get_details(self):134 def get_details(self):
128 """Return the details of the application whose preview is open."""135 """Return the details of the open preview."""
129 title = self.select_single('Label', objectName='titleLabel').text136 title = self.select_single('Label', objectName='titleLabel').text
130 publisher = self.select_single(137 subtitle = self.select_single(
131 'Label', objectName='subtitleLabel').text138 'Label', objectName='subtitleLabel').text
132 # The description label doesn't have an object name. Reported as bug139 # The description label doesn't have an object name. Reported as bug
133 # http://pad.lv/1269114 -- elopio - 2014-1-14140 # http://pad.lv/1269114 -- elopio - 2014-1-14
134 # description = self.select_single(141 # description = self.select_single(
135 # 'Label', objectName='descriptionLabel').text142 # 'Label', objectName='descriptionLabel').text
136 # TODO check screenshots, icon, rating and reviews.143 # TODO check screenshots, icon, rating and reviews.
137 return dict(title=title, publisher=publisher)144 return dict(title=title, subtitle=subtitle)
145
146
147# TODO move this to unity. --elopio - 2014-1-22
148class DashPreview(unity_emulators.UnityEmulatorBase, Preview):
149 """Autopilot emulator for the generic preview."""
150
151
152# TODO move this to unity. --elopio - 2014-1-14
153class AppPreview(unity_emulators.UnityEmulatorBase, Preview):
154 """Autopilot emulator for the application preview."""
155
156 def get_details(self):
157 """Return the details of the application whose preview is open."""
158 details = super(AppPreview, self).get_details()
159 return dict(
160 title=details.get('title'), publisher=details.get('subtitle'))
161
162 def install(self):
163 install_button = self.select_single('Button', objectName='button0')
164 if install_button.text != 'Install':
165 raise unity_emulators.UnityEmulatorException(
166 'Install button not found.')
167 self.pointing_device.click_object(install_button)
168 self.wait_until_destroyed()

Subscribers

People subscribed via source and target branches

to all changes: