~mihirsoni/ubuntu-calendar-app/1291906

« back to all changes in this revision

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

  • Committer: Kunal Parmar
  • Date: 2014-05-24 07:00:58 UTC
  • mfrom: (297 ubuntu-calendar-app)
  • mto: This revision was merged to the branch mainline in revision 312.
  • Revision ID: pkunal.parmar@gmail.com-20140524070058-huxlv1g6uflil4f9
mergeĀ fromĀ trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
71
71
 
72
72
    def test_show_next_days(self):
73
73
        """It must be possible to show next days by swiping the view."""
74
 
        self.change_days(1)
 
74
        self._change_days(1)
75
75
 
76
76
    def test_show_previous_days(self):
77
77
        """It must be possible to show previous days by swiping the view."""
78
 
        self.change_days(-1)
 
78
        self._change_days(-1)
79
79
 
80
 
    def change_days(self, direction):
81
 
        now = datetime.datetime.now()
 
80
    def _change_days(self, direction):
 
81
        firstday = self.day_view.currentDay.datetime
82
82
 
83
83
        for i in range(1, 5):
84
84
            #prevent timing issues with swiping
89
89
 
90
90
            current_day = self.day_view.currentDay.datetime
91
91
 
92
 
            expected_day = (now + datetime.timedelta(
 
92
            expected_day = (firstday + datetime.timedelta(
93
93
                days=(i * direction)))
94
94
 
95
 
            self.assertThat(self.strip(current_day),
96
 
                            Equals(self.strip(expected_day)))
 
95
            self.assertThat(self._strip_time(current_day),
 
96
                            Equals(self._strip_time(expected_day)))
97
97
 
98
 
    def strip(self, date):
 
98
    def _strip_time(self, date):
99
99
        return date.replace(hour=0, minute=0, second=0, microsecond=0)