1
# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
3
"""Tests for the Addressbook App"""
5
# Copyright 2014 Canonical
7
# This program is free software: you can redistribute it and/or modify it
8
# under the terms of the GNU General Public License version 3, as published
9
# by the Free Software Foundation.
10
from __future__ import absolute_import
12
from testtools.matchers import Equals
14
from address_book_app.tests import AddressBookAppTestCase
15
from address_book_app.emulators.contact_list_page import ContactListPage
16
from address_book_app.emulators.toolbar import Toolbar
19
class TestDeleteSelectContact(AddressBookAppTestCase):
21
Delete a contact using pick mode and verify the behavior of Cancel and
43
AddressBookAppTestCase.PRELOAD_VCARD = True
44
super(TestDeleteSelectContact, self).setUp()
46
def test_select(self):
48
Delete a contact in pick mode
50
This test switch the contact list view to pick mode and validate the
51
behavior of Cancel and delete actions by comparing the numbers of
52
contact in the list before and after the action.
53
Note that it doesn't check which contact has been deleted.
55
self.main_window.open_toolbar().click_select()
56
listpage = self.main_window.get_contact_list_page()
57
contacts_before = listpage.get_contacts()
59
listpage.select_contacts_by_index(self.select)
61
if self.action == "cancel":
63
elif self.action == "delete":
67
contacts_after = listpage.get_contacts()
69
# - Verify which contact have been deleted
70
self.assertThat(len(contacts_after), Equals(len(contacts_before) -