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

« back to all changes in this revision

Viewing changes to tests/autopilot/calendar_app/tests/test_monthview.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:
44
44
        direction = int(math.copysign(1, delta))
45
45
 
46
46
        for _ in range(abs(delta)):
47
 
            before = self.app.main_view.to_local_date(
48
 
                month_view.currentMonth.datetime)
 
47
            before = month_view.currentMonth.datetime
49
48
 
50
49
            # prevent timing issues with swiping
51
 
            old_month = self.app.main_view.to_local_date(
52
 
                month_view.currentMonth.datetime)
 
50
            old_month = month_view.currentMonth.datetime
53
51
 
54
52
            self.app.main_view.swipe_view(direction, month_view)
55
53
 
56
 
            month_after = self.app.main_view.to_local_date(
57
 
                month_view.currentMonth.datetime)
 
54
            month_after = month_view.currentMonth.datetime
58
55
 
59
56
            self.assertThat(lambda: month_after,
60
57
                            Eventually(NotEquals(old_month)))
69
66
                            Eventually(Equals(after.year)))
70
67
 
71
68
    def _assert_today(self):
72
 
        local = self.app.main_view.to_local_date(
73
 
            self.month_view.currentMonth.datetime)
74
69
        today = datetime.now()
 
70
        local = self.month_view.currentMonth.datetime
 
71
        converted_local = self.app.main_view.to_local_date(local)
75
72
        logger.debug(local)
 
73
        logger.debug(converted_local)
76
74
        logger.debug(today)
77
75
 
78
76
        self.assertThat(lambda: local.day,
83
81
                        Eventually(Equals(today.year)))
84
82
 
85
83
    def _go_to_today(self, delta):
86
 
        self._assert_today()
87
 
 
88
84
        self._change_month(delta)
89
85
        header = self.app.main_view.get_header()
90
86
        header.click_action_button('todaybutton')
91
 
 
92
87
        self._assert_today()
93
88
 
94
89
    def test_monthview_go_to_today_next_month(self):