~pkunal-parmar/ubuntu-calendar-app/ICalImport

« back to all changes in this revision

Viewing changes to tests/autopilot/calendar_app/tests/test_weekview.py

  • Committer: Tarmac
  • Author(s): Nicholas Skaggs, Alan Pope
  • Date: 2015-05-22 10:02:58 UTC
  • mfrom: (648.1.3 fix-illogical-tests)
  • Revision ID: tarmac-20150522100258-g2cs050059298f6i
fix tests and pep8 errors.

Approved by Alan Pope , Ubuntu Phone Apps Jenkins Bot.

Show diffs side-by-side

added added

removed removed

Lines of Context:
156
156
 
157
157
    def test_selecting_a_day_switches_to_day_view(self):
158
158
        """It must be possible to show a single day by clicking on it."""
159
 
        days = self.week_view.get_days_of_week()
160
159
        today = datetime.datetime.now()
161
 
 
162
 
        # selecting today
163
 
        index = 0
164
 
        for i in range(len(days)):
165
 
            if days[i] == today.day:
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
 
160
        day_to_select = self.week_view.get_current_headerdatecomponent(today)
 
161
 
 
162
        expected_day = day_to_select.date.day
 
163
        expected_month = day_to_select.date.month
 
164
        expected_year = day_to_select.date.year
173
165
 
174
166
        self.app.pointing_device.click_object(day_to_select)
175
167
 
178
170
        self.assertThat(day_view.visible, Eventually(Equals(True)))
179
171
 
180
172
        # Check that the 'Day' view is on the correct/selected day.
181
 
        selected_date = \
182
 
            self.app.main_view.get_day_view().get_selected_day().startDay
183
 
 
184
 
        logger.debug(expected_day)
185
 
        logger.debug(selected_date)
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))
 
173
        day = self.app.main_view.get_day_view().get_selected_day().startDay
 
174
 
 
175
        self.assertThat(expected_day, Equals(day.day))
 
176
        self.assertThat(expected_month, Equals(day.month))
 
177
        self.assertThat(expected_year, Equals(day.year))