~albertomilone/jockey/ubuntu-core-xkit

« back to all changes in this revision

Viewing changes to tests/shipped_handlers.py

  • Committer: Martin Pitt
  • Date: 2008-07-23 07:15:38 UTC
  • mfrom: (105.1.226 trunk)
  • Revision ID: martin.pitt@canonical.com-20080723071538-usb4snd7h128hy3g
merge to 0.4 and trunk head

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
 
23
23
from jockey.oslib import OSLib
24
24
import jockey.detection
 
25
import jockey.backend
25
26
import jockey.xorg_driver
26
27
 
27
28
import sandbox
28
29
 
29
 
class ShippedHandlerTest(unittest.TestCase):
 
30
class ShippedHandlerTest(sandbox.LogTestCase):
30
31
 
31
32
    def setUp(self):
32
33
        '''Provide an AbstractUI instance for getting _() etc. and save/restore
33
34
        /proc/modules, module blacklist, installed packages, and xorg.conf.
34
35
        '''
35
 
        orig_argv = sys.argv
36
 
        sys.argv = ['ui-test']
37
 
        self.ui = sandbox.TestUI()
38
 
        sys.argv = orig_argv
 
36
        self.backend = jockey.backend.Backend()
39
37
 
40
38
        self.orig_oslib = OSLib.inst
41
39
        OSLib.inst = sandbox.AllAvailOSLib()
48
46
 
49
47
        log_offset = sandbox.log.tell()
50
48
        basedir = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
51
 
        handlers = jockey.detection.get_handlers(self.ui, handler_dir=[
 
49
        handlers = jockey.detection.get_handlers(self.backend, handler_dir=[
52
50
            os.path.join(basedir, 'examples', 'handlers'),
53
51
            os.path.join(basedir, 'data', 'handlers') ], available_only=False)
54
52
        log = sandbox.log.getvalue()[log_offset:]
67
65
            s = h.rationale()
68
66
            self.assert_(s is None or hasattr(s, 'isspace'), 
69
67
                '%s.rationale() returns a None or a string' % str(h))
70
 
            self.assert_(hasattr(h.ui_category(), 'isspace'), 
71
 
                '%s.ui_category() returns a string' % str(h))
72
68
            self.assertEqual(h.changed(), False)
73
69
            self.assert_(h.free() in (True, False))
74
70
            self.assert_(h.enabled() in (True, False))