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
1=== modified file 'tests/autopilot/calendar_app/tests/test_dayview.py'
2--- tests/autopilot/calendar_app/tests/test_dayview.py 2015-05-07 18:06:41 +0000
3+++ tests/autopilot/calendar_app/tests/test_dayview.py 2015-05-22 08:54:12 +0000
4@@ -75,23 +75,6 @@
5 self.assertEquals(
6 self.day_view.get_datelabel(today).text, str(now.day))
7
8- # Qt locale will return 0 for Sunday as first day of week
9- # and will return 1 for monday.
10- first_day_of_week = self.day_view.get_timeline_header(today).\
11- firstDayOfWeek
12- if first_day_of_week == 1:
13- week = int(now.strftime("%W"))+1
14- elif first_day_of_week == 0:
15- week = int(now.strftime("%U"))+1
16-
17- logger.warn(first_day_of_week)
18- logger.warn(now)
19- logger.warn(str(week))
20- logger.warn(self.day_view.get_weeknumer(today).text)
21- # Checking week number is correct
22- self.assertEquals(
23- self.day_view.get_weeknumer(today).text, 'W' + str(week))
24-
25 # Check day is scrolled to the current time
26 self.assertEquals(self.day_view.get_scrollHour(), now.hour)
27
28
29=== modified file 'tests/autopilot/calendar_app/tests/test_monthview.py'
30--- tests/autopilot/calendar_app/tests/test_monthview.py 2015-05-07 12:25:20 +0000
31+++ tests/autopilot/calendar_app/tests/test_monthview.py 2015-05-22 08:54:12 +0000
32@@ -44,17 +44,14 @@
33 direction = int(math.copysign(1, delta))
34
35 for _ in range(abs(delta)):
36- before = self.app.main_view.to_local_date(
37- month_view.currentMonth.datetime)
38+ before = month_view.currentMonth.datetime
39
40 # prevent timing issues with swiping
41- old_month = self.app.main_view.to_local_date(
42- month_view.currentMonth.datetime)
43+ old_month = month_view.currentMonth.datetime
44
45 self.app.main_view.swipe_view(direction, month_view)
46
47- month_after = self.app.main_view.to_local_date(
48- month_view.currentMonth.datetime)
49+ month_after = month_view.currentMonth.datetime
50
51 self.assertThat(lambda: month_after,
52 Eventually(NotEquals(old_month)))
53@@ -69,10 +66,11 @@
54 Eventually(Equals(after.year)))
55
56 def _assert_today(self):
57- local = self.app.main_view.to_local_date(
58- self.month_view.currentMonth.datetime)
59 today = datetime.now()
60+ local = self.month_view.currentMonth.datetime
61+ converted_local = self.app.main_view.to_local_date(local)
62 logger.debug(local)
63+ logger.debug(converted_local)
64 logger.debug(today)
65
66 self.assertThat(lambda: local.day,
67@@ -83,12 +81,9 @@
68 Eventually(Equals(today.year)))
69
70 def _go_to_today(self, delta):
71- self._assert_today()
72-
73 self._change_month(delta)
74 header = self.app.main_view.get_header()
75 header.click_action_button('todaybutton')
76-
77 self._assert_today()
78
79 def test_monthview_go_to_today_next_month(self):
80
81=== modified file 'tests/autopilot/calendar_app/tests/test_weekview.py'
82--- tests/autopilot/calendar_app/tests/test_weekview.py 2015-05-09 02:20:09 +0000
83+++ tests/autopilot/calendar_app/tests/test_weekview.py 2015-05-22 08:54:12 +0000
84@@ -156,20 +156,12 @@
85
86 def test_selecting_a_day_switches_to_day_view(self):
87 """It must be possible to show a single day by clicking on it."""
88- days = self.week_view.get_days_of_week()
89 today = datetime.datetime.now()
90-
91- # selecting today
92- index = 0
93- for i in range(len(days)):
94- if days[i] == today.day:
95- index = i
96-
97- day_to_select = self.app.main_view.get_label_with_text(days[index])
98- expected_day = days[index]
99- dayStart = self.week_view.firstDay
100- expected_month = dayStart.month
101- expected_year = dayStart.year
102+ day_to_select = self.week_view.get_current_headerdatecomponent(today)
103+
104+ expected_day = day_to_select.date.day
105+ expected_month = day_to_select.date.month
106+ expected_year = day_to_select.date.year
107
108 self.app.pointing_device.click_object(day_to_select)
109
110@@ -178,12 +170,8 @@
111 self.assertThat(day_view.visible, Eventually(Equals(True)))
112
113 # Check that the 'Day' view is on the correct/selected day.
114- selected_date = \
115- self.app.main_view.get_day_view().get_selected_day().startDay
116-
117- logger.debug(expected_day)
118- logger.debug(selected_date)
119-
120- self.assertThat(expected_day, Equals(selected_date.day))
121- self.assertThat(expected_month, Equals(selected_date.month))
122- self.assertThat(expected_year, Equals(selected_date.year))
123+ day = self.app.main_view.get_day_view().get_selected_day().startDay
124+
125+ self.assertThat(expected_day, Equals(day.day))
126+ self.assertThat(expected_month, Equals(day.month))
127+ self.assertThat(expected_year, Equals(day.year))

Subscribers

People subscribed via source and target branches

to status/vote changes: