1
# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
3
# Copyright (C) 2013, 2014 Canonical Ltd
5
# This program is free software: you can redistribute it and/or modify
6
# it under the terms of the GNU General Public License version 3 as
7
# published by the Free Software Foundation.
9
# This program is distributed in the hope that it will be useful,
10
# but WITHOUT ANY WARRANTY; without even the implied warranty of
11
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
# GNU General Public License for more details.
14
# You should have received a copy of the GNU General Public License
15
# along with this program. If not, see <http://www.gnu.org/licenses/>.
18
Calendar app autopilot tests calendar management.
22
from testtools.matchers import NotEquals, Equals
23
from autopilot.matchers import Eventually
25
from calendar_app import data
27
from calendar_app.tests import CalendarAppTestCaseWithVcard
30
class TestManagement(CalendarAppTestCaseWithVcard):
32
def test_change_calendar_color(self):
33
""" Test changing calendar color """
34
calendar_choice_popup = \
35
self.app.main_view.go_to_calendar_choice_popup()
36
original_calendar_color = \
37
calendar_choice_popup.get_calendar_color()
38
calendar_choice_popup.open_color_picker_dialog()
39
colorPickerDialog = self.app.main_view.get_color_picker_dialog()
40
colorPickerDialog.change_calendar_color("color6")
42
final_calendar_color = \
43
calendar_choice_popup.get_calendar_color()
46
original_calendar_color, NotEquals(final_calendar_color))
48
def test_unselect_calendar(self):
49
""" Test unselecting calendar
51
First adding an Event to then check it no longer appears after
52
deselecting the Personal calendar """
53
test_event = data.Event.make_unique()
54
new_event_page = self.app.main_view.go_to_new_event()
55
new_event_page.add_event(test_event)
57
self.assertThat(lambda: self._event_exists(test_event.name),
58
Eventually(Equals(True)))
60
calendar_choice_popup = \
61
self.app.main_view.go_to_calendar_choice_popup()
62
original_checbox_status = \
63
calendar_choice_popup.get_checkbox_status()
64
calendar_choice_popup.press_check_box_button()
67
original_checbox_status,
68
NotEquals(calendar_choice_popup.get_checkbox_status()))
70
self.app.main_view.press_header_custombackbutton()
71
self.app.main_view.go_to_day_view()
73
self.assertThat(lambda: self._event_exists(test_event.name),
74
Eventually(Equals(False)))
76
def _event_exists(self, event_name):
78
day_view = self.app.main_view.go_to_day_view()
79
day_view.get_event(event_name, True)