~cmiller/desktopcouch/disable-stats-lp746367

« back to all changes in this revision

Viewing changes to desktopcouch/application/tests/__init__.py

  • Committer: Tarmac
  • Author(s): natalia.bidart at canonical, Natalia B. Bidart
  • Date: 2011-01-06 13:02:31 UTC
  • mfrom: (248.1.2 remove-testtools)
  • Revision ID: tarmac-20110106130231-ktkkjsh8x09z8cuu
Removed testtools, replaced with unittest.

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
 
3
3
import atexit
4
4
import os
 
5
import unittest
 
6
import tempfile
5
7
import shutil
6
 
import tempfile
 
8
 
7
9
 
8
10
from desktopcouch.application import local_files
9
11
from desktopcouch.application.start_local_couchdb import start_couchdb
16
18
import gnomekeyring
17
19
 
18
20
 
 
21
class TestCase(unittest.TestCase):
 
22
    """Base class for tests."""
 
23
 
 
24
    def __init__(self, *args, **kwargs):
 
25
        super(TestCase, self).__init__(*args, **kwargs)
 
26
        # pylint: disable=C0103
 
27
        if not hasattr(self, 'assertIn'):
 
28
            self.assertIn = lambda value, container, *args: \
 
29
                            self.assertTrue(value in container, *args)
 
30
        if not hasattr(self, 'assertNotIn'):
 
31
            self.assertNotIn = lambda value, container, *args: \
 
32
                               self.assertTrue(value not in container, *args)
 
33
        if not hasattr(self, 'assertIs'):
 
34
            self.assertIs = lambda value1, value2, *args: \
 
35
                            self.assertTrue(value1 is value2, *args)
 
36
        if not hasattr(self, 'assertIsNot'):
 
37
            self.assertIsNot = lambda value1, value2, *args: \
 
38
                               self.assertTrue(value1 is not value2, *args)
 
39
 
 
40
 
19
41
class TestSecret(object):
20
42
    """Test secret."""
21
43
    def __init__(self, secret):