~diegosarmentero/ubuntu-sso-client/forgotten-link

« back to all changes in this revision

Viewing changes to ubuntu_sso/utils/runner/tests/test_runner.py

  • Committer: Tarmac
  • Author(s): Natalia B. Bidart
  • Date: 2012-02-18 14:52:57 UTC
  • mfrom: (877.1.7 fix-933632)
  • Revision ID: tarmac-20120218145257-p5809z6j701j0v8a
- Make gettext return unicode strings. Also, transform arguments passed to
  the GLib spawnner to bytes (LP: #933632).

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
from ubuntu_sso.utils import runner
25
25
 
26
26
 
27
 
TEST_ME_DIR = 'test-me'
 
27
TEST_ME_DIR = u'test-me-more-♥'
 
28
TEST_ME_DIR_BYTES = TEST_ME_DIR.encode('utf-8')
28
29
 
29
30
 
30
31
class SpawnProgramTestCase(TestCase):
31
32
    """The test suite for the spawn_program method."""
32
33
 
33
34
    timeout = 3
34
 
    args = ('python', '-c', 'import os; os.system("mkdir %s")' % TEST_ME_DIR)
 
35
    args = (u'python', u'-c',
 
36
            u'import os; os.system("mkdir %s")' % TEST_ME_DIR)
35
37
 
36
38
    @defer.inlineCallbacks
37
39
    def setUp(self):
38
40
        yield super(SpawnProgramTestCase, self).setUp()
39
 
        assert not os.path.exists(TEST_ME_DIR)
40
 
        self.addCleanup(lambda: os.path.exists(TEST_ME_DIR) and
41
 
                                os.rmdir(TEST_ME_DIR))
 
41
        assert not os.path.exists(TEST_ME_DIR_BYTES)
 
42
        self.addCleanup(lambda: os.path.exists(TEST_ME_DIR_BYTES) and
 
43
                                os.rmdir(TEST_ME_DIR_BYTES))
42
44
 
43
45
    def spawn_fn(self, args):
44
46
        """The target function to test."""
46
48
 
47
49
    def assert_command_was_run(self):
48
50
        """The spawnned commnad was correctly run."""
49
 
        self.assertTrue(os.path.exists(TEST_ME_DIR))
50
 
        self.assertTrue(os.path.isdir(TEST_ME_DIR))
 
51
        self.assertTrue(os.path.exists(TEST_ME_DIR_BYTES))
 
52
        self.assertTrue(os.path.isdir(TEST_ME_DIR_BYTES))
51
53
 
52
54
    @defer.inlineCallbacks
53
55
    def test_program_is_spawned(self):