~dylanmccall/update-manager/dialogs-refactor

« back to all changes in this revision

Viewing changes to janitor/plugincore/tests/test_deb_plugin.py

  • Committer: Barry Warsaw
  • Date: 2012-06-11 15:08:35 UTC
  • mto: (2446.1.6 py3)
  • mto: This revision was merged to the branch mainline in revision 2454.
  • Revision ID: barry@python.org-20120611150835-lbx9cjwzfjy3y7bw
Re-integrate the Python 3 Computer Janitor refactoring branch for now.  The
code itself lives in ~computer-janitor-hackers/computer-janitor/py3refactor
and will eventually be ripped out of here, but for now, this unblocks other
folks.

Still getting test failures in `bzr bd -S` though.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# Copyright (C) 2008-2012  Canonical, Ltd.
 
2
#
 
3
# This program is free software: you can redistribute it and/or modify it
 
4
# under the terms of the GNU General Public License as published by the Free
 
5
# Software Foundation, version 3 of the License.
 
6
#
 
7
# This program is distributed in the hope that it will be useful, but WITHOUT
 
8
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 
9
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
 
10
# more details.
 
11
#
 
12
# You should have received a copy of the GNU General Public License along with
 
13
# this program.  If not, see <http://www.gnu.org/licenses/>.
 
14
 
 
15
from __future__ import absolute_import, print_function, unicode_literals
 
16
 
 
17
__metaclass__ = type
 
18
__all__ = [
 
19
    'DebPluginTests',
 
20
    ]
 
21
 
 
22
 
 
23
import unittest
 
24
 
 
25
from janitor.plugincore.plugins.deb_plugin import DebPlugin
 
26
from janitor.plugincore.testing.helpers import Application
 
27
 
 
28
 
 
29
class DebPluginTests(unittest.TestCase):
 
30
    def setUp(self):
 
31
        self.plugin = DebPlugin()
 
32
        self.app = Application()
 
33
        self.plugin.set_application(self.app)
 
34
 
 
35
    def test_no_cruft(self):
 
36
        self.assertEqual(self.plugin.get_cruft(), [])
 
37
 
 
38
    def test_post_cleanup_calls_commit(self):
 
39
        self.plugin.post_cleanup()
 
40
        self.assertTrue(self.app.commit_called)
 
41
 
 
42
    def test_post_cleanup_calls_refresh(self):
 
43
        self.plugin.post_cleanup()
 
44
        self.assertTrue(self.app.refresh_called)