~ubuntu-branches/ubuntu/natty/computer-janitor/natty

« back to all changes in this revision

Viewing changes to computerjanitor/cruft_tests.py

  • Committer: Bazaar Package Importer
  • Author(s): Lars Wirzenius
  • Date: 2009-02-19 09:37:52 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20090219093752-4e3rkcoatpr4x2u8
Tags: 1.12-0ubuntu1
* New upstream release.
* Upstream source has partially been moved to update-manager. This
  has resulted in some packaging changes.
* debian/control: Add dependency on update-manager-core for 
  computer-janitor, on the version of update-manager-core that includes
  the computer-janitor core code (plugin management, plugins).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# cruft_tests.py - unit tests for cruft.py
2
 
# Copyright (C) 2008  Canonical, Ltd.
3
 
#
4
 
# This program is free software: you can redistribute it and/or modify
5
 
# it under the terms of the GNU General Public License as published by
6
 
# the Free Software Foundation, version 3 of the License.
7
 
#
8
 
# This program is distributed in the hope that it will be useful,
9
 
# but WITHOUT ANY WARRANTY; without even the implied warranty of
10
 
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11
 
# GNU General Public License for more details.
12
 
#
13
 
# You should have received a copy of the GNU General Public License
14
 
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
15
 
 
16
 
 
17
 
import unittest
18
 
 
19
 
import computerjanitor
20
 
 
21
 
 
22
 
class CruftTests(unittest.TestCase):
23
 
 
24
 
    def setUp(self):
25
 
        self.cruft = computerjanitor.Cruft()
26
 
 
27
 
    def testRaisesErrorForDefaultGetPrefix(self):
28
 
        self.assertRaises(computerjanitor.UnimplementedMethod,
29
 
                          self.cruft.get_prefix)
30
 
 
31
 
    def testReturnsEmptyStringAsDefaultPrefixDescription(self):
32
 
        self.assertEqual(self.cruft.get_prefix_description(), "")
33
 
 
34
 
    def testRaisesErrorForDefaultGetShortname(self):
35
 
        self.assertRaises(computerjanitor.UnimplementedMethod,
36
 
                          self.cruft.get_shortname)
37
 
 
38
 
    def testReturnsCorrectStringForFullName(self):
39
 
        self.cruft.get_prefix = lambda *args: "foo"
40
 
        self.cruft.get_shortname = lambda *args: "bar"
41
 
        self.assertEqual(self.cruft.get_name(), "foo:bar")
42
 
 
43
 
    def testReturnsEmptyStringAsDefaultDescription(self):
44
 
        self.assertEqual(self.cruft.get_description(), "")
45
 
 
46
 
    def testReturnsNoneForDiskUsage(self):
47
 
        self.assertEqual(self.cruft.get_disk_usage(), None)
48
 
 
49
 
    def testRaisesErrorForDefaultCleanup(self):
50
 
        self.assertRaises(computerjanitor.UnimplementedMethod,
51
 
                          self.cruft.cleanup)