Merge lp:~popey/ubuntu-calendar-app/fix-illogical-tests into lp:ubuntu-calendar-app

Status: Merged
Approved by: Alan Pope 🍺🐧🐱 πŸ¦„
Approved revision: 651
Merged at revision: 649
Proposed branch: lp:~popey/ubuntu-calendar-app/fix-illogical-tests
Merge into: lp:ubuntu-calendar-app
Diff against target: 127 lines (+16/-50)
3 files modified
tests/autopilot/calendar_app/tests/test_dayview.py (+0/-17)
tests/autopilot/calendar_app/tests/test_monthview.py (+6/-11)
tests/autopilot/calendar_app/tests/test_weekview.py (+10/-22)
To merge this branch: bzr merge lp:~popey/ubuntu-calendar-app/fix-illogical-tests
Reviewer Review Type Date Requested Status
Alan Pope 🍺🐧🐱 πŸ¦„ (community) Approve
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve
Review via email: mp+259899@code.launchpad.net

Commit message

fix tests and pep8 errors.

To post a comment you must log in.
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Alan Pope 🍺🐧🐱 πŸ¦„ (popey) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'tests/autopilot/calendar_app/tests/test_dayview.py'
--- tests/autopilot/calendar_app/tests/test_dayview.py 2015-05-07 18:06:41 +0000
+++ tests/autopilot/calendar_app/tests/test_dayview.py 2015-05-22 08:54:12 +0000
@@ -75,23 +75,6 @@
75 self.assertEquals(75 self.assertEquals(
76 self.day_view.get_datelabel(today).text, str(now.day))76 self.day_view.get_datelabel(today).text, str(now.day))
7777
78 # Qt locale will return 0 for Sunday as first day of week
79 # and will return 1 for monday.
80 first_day_of_week = self.day_view.get_timeline_header(today).\
81 firstDayOfWeek
82 if first_day_of_week == 1:
83 week = int(now.strftime("%W"))+1
84 elif first_day_of_week == 0:
85 week = int(now.strftime("%U"))+1
86
87 logger.warn(first_day_of_week)
88 logger.warn(now)
89 logger.warn(str(week))
90 logger.warn(self.day_view.get_weeknumer(today).text)
91 # Checking week number is correct
92 self.assertEquals(
93 self.day_view.get_weeknumer(today).text, 'W' + str(week))
94
95 # Check day is scrolled to the current time78 # Check day is scrolled to the current time
96 self.assertEquals(self.day_view.get_scrollHour(), now.hour)79 self.assertEquals(self.day_view.get_scrollHour(), now.hour)
9780
9881
=== modified file 'tests/autopilot/calendar_app/tests/test_monthview.py'
--- tests/autopilot/calendar_app/tests/test_monthview.py 2015-05-07 12:25:20 +0000
+++ tests/autopilot/calendar_app/tests/test_monthview.py 2015-05-22 08:54:12 +0000
@@ -44,17 +44,14 @@
44 direction = int(math.copysign(1, delta))44 direction = int(math.copysign(1, delta))
4545
46 for _ in range(abs(delta)):46 for _ in range(abs(delta)):
47 before = self.app.main_view.to_local_date(47 before = month_view.currentMonth.datetime
48 month_view.currentMonth.datetime)
4948
50 # prevent timing issues with swiping49 # prevent timing issues with swiping
51 old_month = self.app.main_view.to_local_date(50 old_month = month_view.currentMonth.datetime
52 month_view.currentMonth.datetime)
5351
54 self.app.main_view.swipe_view(direction, month_view)52 self.app.main_view.swipe_view(direction, month_view)
5553
56 month_after = self.app.main_view.to_local_date(54 month_after = month_view.currentMonth.datetime
57 month_view.currentMonth.datetime)
5855
59 self.assertThat(lambda: month_after,56 self.assertThat(lambda: month_after,
60 Eventually(NotEquals(old_month)))57 Eventually(NotEquals(old_month)))
@@ -69,10 +66,11 @@
69 Eventually(Equals(after.year)))66 Eventually(Equals(after.year)))
7067
71 def _assert_today(self):68 def _assert_today(self):
72 local = self.app.main_view.to_local_date(
73 self.month_view.currentMonth.datetime)
74 today = datetime.now()69 today = datetime.now()
70 local = self.month_view.currentMonth.datetime
71 converted_local = self.app.main_view.to_local_date(local)
75 logger.debug(local)72 logger.debug(local)
73 logger.debug(converted_local)
76 logger.debug(today)74 logger.debug(today)
7775
78 self.assertThat(lambda: local.day,76 self.assertThat(lambda: local.day,
@@ -83,12 +81,9 @@
83 Eventually(Equals(today.year)))81 Eventually(Equals(today.year)))
8482
85 def _go_to_today(self, delta):83 def _go_to_today(self, delta):
86 self._assert_today()
87
88 self._change_month(delta)84 self._change_month(delta)
89 header = self.app.main_view.get_header()85 header = self.app.main_view.get_header()
90 header.click_action_button('todaybutton')86 header.click_action_button('todaybutton')
91
92 self._assert_today()87 self._assert_today()
9388
94 def test_monthview_go_to_today_next_month(self):89 def test_monthview_go_to_today_next_month(self):
9590
=== modified file 'tests/autopilot/calendar_app/tests/test_weekview.py'
--- tests/autopilot/calendar_app/tests/test_weekview.py 2015-05-09 02:20:09 +0000
+++ tests/autopilot/calendar_app/tests/test_weekview.py 2015-05-22 08:54:12 +0000
@@ -156,20 +156,12 @@
156156
157 def test_selecting_a_day_switches_to_day_view(self):157 def test_selecting_a_day_switches_to_day_view(self):
158 """It must be possible to show a single day by clicking on it."""158 """It must be possible to show a single day by clicking on it."""
159 days = self.week_view.get_days_of_week()
160 today = datetime.datetime.now()159 today = datetime.datetime.now()
161160 day_to_select = self.week_view.get_current_headerdatecomponent(today)
162 # selecting today161
163 index = 0162 expected_day = day_to_select.date.day
164 for i in range(len(days)):163 expected_month = day_to_select.date.month
165 if days[i] == today.day:164 expected_year = day_to_select.date.year
166 index = i
167
168 day_to_select = self.app.main_view.get_label_with_text(days[index])
169 expected_day = days[index]
170 dayStart = self.week_view.firstDay
171 expected_month = dayStart.month
172 expected_year = dayStart.year
173165
174 self.app.pointing_device.click_object(day_to_select)166 self.app.pointing_device.click_object(day_to_select)
175167
@@ -178,12 +170,8 @@
178 self.assertThat(day_view.visible, Eventually(Equals(True)))170 self.assertThat(day_view.visible, Eventually(Equals(True)))
179171
180 # Check that the 'Day' view is on the correct/selected day.172 # Check that the 'Day' view is on the correct/selected day.
181 selected_date = \173 day = self.app.main_view.get_day_view().get_selected_day().startDay
182 self.app.main_view.get_day_view().get_selected_day().startDay174
183175 self.assertThat(expected_day, Equals(day.day))
184 logger.debug(expected_day)176 self.assertThat(expected_month, Equals(day.month))
185 logger.debug(selected_date)177 self.assertThat(expected_year, Equals(day.year))
186
187 self.assertThat(expected_day, Equals(selected_date.day))
188 self.assertThat(expected_month, Equals(selected_date.month))
189 self.assertThat(expected_year, Equals(selected_date.year))

Subscribers

People subscribed via source and target branches

to status/vote changes: