~ubuntu-branches/ubuntu/precise/desktopcouch/precise

« back to all changes in this revision

Viewing changes to desktopcouch/application/plugins/tests/test_plugins.py

  • Committer: Bazaar Package Importer
  • Author(s): Chad MILLER
  • Date: 2011-01-12 15:08:25 UTC
  • mfrom: (1.5.10 upstream)
  • Revision ID: james.westby@ubuntu.com-20110112150825-bzvn23kzufr0qdyb
Tags: 1.0.5-0ubuntu1
* New upstream release, skipping a few buggy releases.
* Split code into binary packages:
  - desktopcouch, configuration files and dependencies, but no code.
  - python-desktopcouch: transitional package
  - python-desktopcouch-application: local DB startup and discovery
  - python-desktopcouch-records: library for DB access anywhere
  - python-desktopcouch-recordtypes: support specific data structures
  - desktopcouch-ubuntuone, replication and pairing with cloud service
* Drop patch that some maverick apps incorrectly needed.
  patches/0-items-should-expose-private-data-for-now.patch
* Update package compatibility-version, 6 -> 7.
* Use newer debhelper and use python-support instead of python-central.
* Depend on contemporary python-couchdb, instead of ancient version.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# Copyright 2011 Canonical Ltd.
 
2
#
 
3
# This file is part of desktopcouch.
 
4
#
 
5
# desktopcouch is free software: you can redistribute it and/or modify
 
6
# it under the terms of the GNU Lesser General Public License version 3
 
7
# as published by the Free Software Foundation.
 
8
#
 
9
# desktopcouch is distributed in the hope that it will be useful,
 
10
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
11
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
12
# GNU Lesser General Public License for more details.
 
13
#
 
14
# You should have received a copy of the GNU Lesser General Public License
 
15
# along with desktopcouch.  If not, see <http://www.gnu.org/licenses/>.
 
16
"""Tests for the plug-ins loading."""
 
17
 
 
18
import os
 
19
 
 
20
from desktopcouch.application import plugins
 
21
from unittest import TestCase
 
22
 
 
23
 
 
24
class TestLoadPlugins(TestCase):
 
25
    """Tests for loading plug-ins."""
 
26
 
 
27
    def test_load_plugins(self):
 
28
        """Test that plug-ins are loaded correctly."""
 
29
        # pylint: disable=W0201
 
30
        old_paths = plugins.DESKTOPCOUCH_PLUGIN_PATHS
 
31
        plugins.DESKTOPCOUCH_PLUGIN_PATHS = [os.path.join(
 
32
                os.path.dirname(__file__))]
 
33
        self._imported = None
 
34
 
 
35
        def _fake_import(name, *args, **kwargs):
 
36
            """Fake import to check that we get imported."""
 
37
            modname = name.replace('.test_', '.tests.test_')
 
38
            if modname == __name__:
 
39
                self._imported = modname
 
40
        old_import = __import__
 
41
        __builtins__['__import__'] = _fake_import
 
42
        plugins.load_plugins()
 
43
        __builtins__['__import__'] = old_import
 
44
        plugins.DESKTOPCOUCH_PLUGIN_PATHS = old_paths
 
45
        self.assertEqual(self._imported, __name__)