Merge lp:~nskaggs/reminders-app/finish-go-to-accounts into lp:reminders-app

Proposed by Nicholas Skaggs
Status: Rejected
Rejected by: Nicholas Skaggs
Proposed branch: lp:~nskaggs/reminders-app/finish-go-to-accounts
Merge into: lp:reminders-app
Diff against target: 170 lines (+131/-2)
4 files modified
debian/control (+3/-0)
tests/autopilot/reminders/fake_services.py (+66/-0)
tests/autopilot/reminders/fixture_setup.py (+34/-0)
tests/autopilot/reminders/tests/test_reminders.py (+28/-2)
To merge this branch: bzr merge lp:~nskaggs/reminders-app/finish-go-to-accounts
Reviewer Review Type Date Requested Status
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve
Ubuntu Notes app developers Pending
Review via email: mp+217946@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Nicholas Skaggs (nskaggs) wrote :

Trying to see if jenkins will still complain after rebasing to trunk.

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Needs Fixing (continuous-integration)
107. By Nicholas Skaggs

try switching to reminders_app

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Needs Fixing (continuous-integration)
108. By Nicholas Skaggs

switch to reminders_app and try jenkins

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Needs Fixing (continuous-integration)
109. By Nicholas Skaggs

revert back to reminders

110. By Nicholas Skaggs

revert python3 depends

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)

Unmerged revisions

110. By Nicholas Skaggs

revert python3 depends

109. By Nicholas Skaggs

revert back to reminders

108. By Nicholas Skaggs

switch to reminders_app and try jenkins

107. By Nicholas Skaggs

try switching to reminders_app

106. By Nicholas Skaggs

rebase to trunk

105. By Nicholas Skaggs

elopio's test account2

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/control'
2--- debian/control 2014-04-04 06:15:42 +0000
3+++ debian/control 2014-05-01 18:07:26 +0000
4@@ -51,6 +51,9 @@
5 reminders-app (= ${source:Version}),
6 libautopilot-qt,
7 libqt5test5,
8+ python-dbus,
9+ python-dbusmock,
10+ python-fixtures,
11 ubuntu-ui-toolkit-autopilot,
12 Description: Test package for the Reminders app
13 Autopilot tests for the Reminders app package
14
15=== added file 'tests/autopilot/reminders/fake_services.py'
16--- tests/autopilot/reminders/fake_services.py 1970-01-01 00:00:00 +0000
17+++ tests/autopilot/reminders/fake_services.py 2014-05-01 18:07:26 +0000
18@@ -0,0 +1,66 @@
19+# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
20+#
21+# Copyright (C) 2014 Canonical Ltd.
22+#
23+# This file is part of reminders
24+#
25+# reminders is free software: you can redistribute it and/or modify
26+# it under the terms of the GNU General Public License as published by
27+# the Free Software Foundation; version 3.
28+#
29+# reminders is distributed in the hope that it will be useful,
30+# but WITHOUT ANY WARRANTY; without even the implied warranty of
31+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
32+# GNU General Public License for more details.
33+#
34+# You should have received a copy of the GNU General Public License
35+# along with this program. If not, see <http://www.gnu.org/licenses/>.
36+
37+import subprocess
38+
39+import dbus
40+import dbusmock
41+
42+import reminders
43+
44+
45+class FakeURLDispatcherService(object):
46+ """Fake URL Dispatcher service using a dbusmock interface."""
47+
48+ def __init__(self):
49+ super(FakeURLDispatcherService, self).__init__()
50+ self.dbus_connection = dbusmock.DBusTestCase.get_dbus(system_bus=False)
51+
52+ def start(self):
53+ """Start the fake URL Dispatcher service."""
54+ # Stop the real url-dispatcher.
55+ subprocess.call(['initctl', 'stop', 'url-dispatcher'])
56+ self.dbus_mock_server = dbusmock.DBusTestCase.spawn_server(
57+ 'com.canonical.URLDispatcher',
58+ '/com/canonical/URLDispatcher',
59+ 'com.canonical.URLDispatcher',
60+ system_bus=False,
61+ stdout=subprocess.PIPE)
62+ self.mock = self._get_mock_interface()
63+ self.mock.AddMethod(
64+ 'com.canonical.URLDispatcher', 'DispatchURL', 's', '', '')
65+
66+ def _get_mock_interface(self):
67+ return dbus.Interface(
68+ self.dbus_connection.get_object(
69+ 'com.canonical.URLDispatcher', '/com/canonical/URLDispatcher'),
70+ dbusmock.MOCK_IFACE)
71+
72+ def stop(self):
73+ """Stop the fake URL Dispatcher service."""
74+ self.dbus_mock_server.terminate()
75+ self.dbus_mock_server.wait()
76+
77+ def get_last_dispatch_url_call_parameter(self):
78+ """Return the parameter used in the last call to dispatch URL."""
79+ calls = self.mock.GetCalls()
80+ if len(calls) == 0:
81+ raise reminders.RemindersAppException(
82+ 'URL dispatcher has not been called.')
83+ last_call = self.mock.GetCalls()[-1]
84+ return last_call[2][0]
85
86=== added file 'tests/autopilot/reminders/fixture_setup.py'
87--- tests/autopilot/reminders/fixture_setup.py 1970-01-01 00:00:00 +0000
88+++ tests/autopilot/reminders/fixture_setup.py 2014-05-01 18:07:26 +0000
89@@ -0,0 +1,34 @@
90+# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
91+#
92+# Copyright (C) 2014 Canonical Ltd.
93+#
94+# This file is part of reminders
95+#
96+# reminders is free software: you can redistribute it and/or modify
97+# it under the terms of the GNU General Public License as published by
98+# the Free Software Foundation; version 3.
99+#
100+# reminders is distributed in the hope that it will be useful,
101+# but WITHOUT ANY WARRANTY; without even the implied warranty of
102+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
103+# GNU General Public License for more details.
104+#
105+# You should have received a copy of the GNU General Public License
106+# along with this program. If not, see <http://www.gnu.org/licenses/>.
107+
108+
109+import fixtures
110+
111+from reminders import fake_services
112+
113+
114+class FakeURLDispatcher(fixtures.Fixture):
115+
116+ def setUp(self):
117+ super(FakeURLDispatcher, self).setUp()
118+ self.fake_service = fake_services.FakeURLDispatcherService()
119+ self.addCleanup(self.fake_service.stop)
120+ self.fake_service.start()
121+
122+ def get_last_dispatch_url_call_parameter(self):
123+ return self.fake_service.get_last_dispatch_url_call_parameter()
124
125=== modified file 'tests/autopilot/reminders/tests/test_reminders.py'
126--- tests/autopilot/reminders/tests/test_reminders.py 2014-04-04 06:14:54 +0000
127+++ tests/autopilot/reminders/tests/test_reminders.py 2014-05-01 18:07:26 +0000
128@@ -18,10 +18,16 @@
129
130 from __future__ import absolute_import
131
132-from reminders import tests
133-
134 import logging
135
136+from autopilot import platform
137+from autopilot.matchers import Eventually
138+from testtools.matchers import Equals
139+
140+import reminders
141+from reminders import fixture_setup, tests
142+
143+
144 logger = logging.getLogger(__name__)
145
146
147@@ -30,3 +36,23 @@
148 def test_open_application_without_account(self):
149 """Test that the No account dialog is visible."""
150 self.assertTrue(self.app.main_view.no_account_dialog.visible)
151+
152+ def test_go_to_account_settings(self):
153+ """Test that the Go to account settings button calls url-dispatcher."""
154+ if platform.model() == 'Desktop':
155+ self.skipTest("URL dispatcher doesn't work on the desktop.")
156+ url_dispatcher = fixture_setup.FakeURLDispatcher()
157+ self.useFixture(url_dispatcher)
158+
159+ self.app.main_view.no_account_dialog.open_account_settings()
160+
161+ def get_last_dispatch_url_call_parameter():
162+ # Workaround for http://pad.lv/1312384
163+ try:
164+ return url_dispatcher.get_last_dispatch_url_call_parameter()
165+ except reminders.RemindersAppException:
166+ return None
167+
168+ self.assertThat(
169+ get_last_dispatch_url_call_parameter,
170+ Eventually(Equals('settings:///system/online-accounts')))

Subscribers

People subscribed via source and target branches