~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_gpg.py

  • Committer: John Arbash Meinel
  • Date: 2005-12-15 21:39:34 UTC
  • mto: (1185.50.20 bzr-jam-integration)
  • mto: This revision was merged to the branch mainline in revision 1532.
  • Revision ID: john@arbash-meinel.com-20051215213934-c604f80de4902abf
Stores don't have to have a dir_mode or file_mode set

Show diffs side-by-side

added added

removed removed

Lines of Context:
47
47
    def test_returns_output(self):
48
48
        # This test needs a 'cat' command or similar to work.
49
49
        my_gpg = gpg.GPGStrategy(FakeConfig())
50
 
        content = "some content\nwith newlines\n"
51
 
 
52
 
        if sys.platform == 'win32':
53
 
            # Windows doesn't come with cat, and we don't require it
54
 
            # so lets try using python instead.
55
 
            # But stupid windows and line-ending conversions. 
56
 
            # It is too much work to make sys.stdout be in binary mode.
57
 
            # http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65443
58
 
            my_gpg._command_line = lambda:[sys.executable, '-c',
59
 
                    'import sys; sys.stdout.write(sys.stdin.read())']
60
 
            new_content = content.replace('\n', '\r\n')
61
 
 
62
 
            self.assertEqual(new_content, my_gpg.sign(content))
63
 
        else:
64
 
            my_gpg._command_line = lambda:['cat', '-']
65
 
            self.assertEqual(content, my_gpg.sign(content))
 
50
        my_gpg._command_line = lambda:["cat", "-"]
 
51
        self.assertEqual("some content\nwith newlines\n",
 
52
                         my_gpg.sign("some content\nwith newlines\n"))
66
53
 
67
54
 
68
55
class TestDisabled(TestCase):