/usr/lib/python2.7/dist-packages/ubuntu_system_settings/tests/test_system_updates.py is in ubuntu-system-settings-autopilot 0.1+14.04.20140411-0ubuntu2.
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 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 | # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
# Copyright 2013 Canonical
#
# 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.
from __future__ import absolute_import
import os
from autopilot.introspection.dbus import StateNotFoundError
from autopilot.matchers import Eventually
from testtools.matchers import Equals, NotEquals, raises
from ubuntu_system_settings.tests import SystemUpdatesBaseTestCase
""" Tests for Ubuntu System Settings """
class SystemUpdatesTestCases(SystemUpdatesBaseTestCase):
"""Tests for System Updates."""
def setUp(self):
# Set environment variables
os.environ["IGNORE_CREDENTIALS"] = "True"
os.environ["IGNORE_UPDATES"] = "IGNORE_UPDATES"
super(SystemUpdatesTestCases, self).setUp()
def test_show_updates(self):
""" Checks whether Search box actually filters the results """
updates = self.updates_page
self.assertThat(updates, NotEquals(None))
# Move to text field
self.scroll_to_and_click(updates)
def test_updates_not_in_main(self):
"""Check that the updates notification is shown in main."""
self.assertThat(lambda: self.main_view.select_single(
objectName='entryComponent-updates'), raises(StateNotFoundError))
def test_configuration(self):
"""Check the configuration button."""
self.assertThat(lambda: self.main_view.select_single(
objectName='configurationPage'), raises(StateNotFoundError))
updates = self.updates_page
self.assertThat(updates, NotEquals(None))
configuration = updates.select_single(objectName='configuration')
self.assertThat(configuration, NotEquals(None))
self.scroll_to_and_click(configuration)
def test_check_for_updates_area(self):
"""Check that the updates area is shown on opening."""
updates = self.updates_page
self.assertThat(updates, NotEquals(None))
checkForUpdatesArea = updates.select_single(
objectName='checkForUpdatesArea')
self.assertThat(checkForUpdatesArea, NotEquals(None))
self.assertThat(checkForUpdatesArea.visible, Equals(True))
self.assertThat(checkForUpdatesArea.visible,
Eventually(NotEquals(True)))
def test_searching_state(self):
"""Check how the ui reacts to searching state."""
updates = self.updates_page
self.assertThat(updates, NotEquals(None))
updates.state.wait_for("SEARCHING")
self.assertThat(updates.state, Equals("SEARCHING"))
notification = updates.select_single(
objectName='notification')
self.assertThat(notification, NotEquals(None))
self.assertThat(notification.visible, Equals(False))
installAllButton = updates.select_single(
objectName='installAllButton')
self.assertThat(installAllButton, NotEquals(None))
self.assertThat(installAllButton.visible, Equals(False))
updateNotification = updates.select_single(
objectName='updateNotification')
self.assertThat(updateNotification, NotEquals(None))
self.assertThat(updateNotification.visible, Equals(False))
checkForUpdatesArea = updates.select_single(
objectName='checkForUpdatesArea')
self.assertThat(checkForUpdatesArea, NotEquals(None))
self.assertThat(checkForUpdatesArea.visible, Equals(True))
def test_no_updates_state(self):
"""Check how the ui reacts to no updates state."""
updates = self.updates_page
self.assertThat(updates, NotEquals(None))
updates.state.wait_for("NOUPDATES")
self.assertThat(updates.state, Equals("NOUPDATES"))
updateList = updates.select_single(
objectName='updateList')
self.assertThat(updateList, NotEquals(None))
self.assertThat(updateList.visible, Equals(False))
installAllButton = updates.select_single(
objectName='installAllButton')
self.assertThat(installAllButton, NotEquals(None))
self.assertThat(installAllButton.visible, Equals(False))
updateNotification = updates.select_single(
objectName='updateNotification')
self.assertThat(updateNotification, NotEquals(None))
self.assertThat(updateNotification.visible, Equals(True))
|