/usr/lib/python3/dist-packages/reminders/tests/test_credentials.py is in reminders-app-autopilot 0.4+15.04.20141118-0ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 | # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
#
# Copyright (C) 2014 Canonical Ltd
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 3 as
# published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import logging
from gi.repository import Accounts
from testtools.matchers import HasLength
from reminders import credentials, evernote, tests
logger = logging.getLogger(__name__)
class EvernoteCredentialsTestCase(tests.BaseTestCaseWithTempHome):
def setUp(self):
super(EvernoteCredentialsTestCase, self).setUp()
self.account_manager = credentials.AccountManager()
def add_evernote_account(self):
account = self.account_manager.add_evernote_account(
'dummy', 'dummy', evernote.TEST_OAUTH_TOKEN)
self.addCleanup(self.delete_account_and_manager, account)
return account
def delete_account_and_manager(self, account):
if account.id in self.account_manager._manager.list():
self.account_manager.delete_account(account)
del self.account_manager._manager
del self.account_manager
def test_add_evernote_account_must_enable_it(self):
account = self.add_evernote_account()
self.assertTrue(account.get_enabled())
def test_add_evernote_account_must_set_provider(self):
account = self.add_evernote_account()
provider_id = 'com.ubuntu.reminders_evernote-account-plugin-sandbox'
self.assertEqual(account.get_provider_name(), provider_id)
def test_add_evernote_account_must_enable_evernote_service(self):
account = self.add_evernote_account()
services = account.list_services()
self.assertThat(services, HasLength(1))
service_id = 'com.ubuntu.reminders_reminders-sandbox'
self.assertEqual(services[0].get_name(), service_id)
service = Accounts.AccountService.new(account, services[0])
self.assertTrue(service.get_enabled())
def test_delete_evernote_account_must_remove_it(self):
account = self.add_evernote_account()
self.assertThat(self.account_manager._manager.list(), HasLength(1))
self.account_manager.delete_account(account)
self.assertThat(self.account_manager._manager.list(), HasLength(0))
|