/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to brzlib/tests/commands/test_cat.py

  • Committer: Jelmer Vernooij
  • Date: 2017-05-21 12:41:27 UTC
  • mto: This revision was merged to the branch mainline in revision 6623.
  • Revision ID: jelmer@jelmer.uk-20170521124127-iv8etg0vwymyai6y
s/bzr/brz/ in apport config.

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
 
17
17
import sys
18
18
 
19
 
from ...builtins import cmd_cat
20
 
from ...tests import (
21
 
    ui_testing,
22
 
    )
23
 
from ...tests.transport_util import TestCaseWithConnectionHookedTransport
 
19
from brzlib.builtins import cmd_cat
 
20
from brzlib.tests import StringIOWrapper
 
21
from brzlib.tests.transport_util import TestCaseWithConnectionHookedTransport
24
22
 
25
23
 
26
24
class TestCat(TestCaseWithConnectionHookedTransport):
27
25
 
 
26
    def setUp(self):
 
27
        super(TestCat, self).setUp()
 
28
        # Redirect sys.stdout as this is what cat uses
 
29
        self.outf = StringIOWrapper()
 
30
        self.overrideAttr(sys, 'stdout', self.outf)
 
31
 
28
32
    def test_cat(self):
 
33
        # FIXME: sftp raises ReadError instead of NoSuchFile when probing for
 
34
        # branch/foo/.bzr/branch-format when used with the paramiko test
 
35
        # server.
 
36
        from brzlib.tests import TestSkipped
 
37
        raise TestSkipped('SFTPTransport raises incorrect exception'
 
38
                          ' when reading from paramiko server')
29
39
        wt1 = self.make_branch_and_tree('branch')
30
 
        self.build_tree_contents([('branch/foo', b'foo')])
 
40
        self.build_tree_contents([('branch/foo', 'foo')])
31
41
        wt1.add('foo')
32
42
        wt1.commit('add foo')
33
43
 
34
44
        self.start_logging_connections()
35
45
 
36
46
        cmd = cmd_cat()
37
 
        cmd.outf = ui_testing.StringIOWithEncoding()
38
47
        cmd.run(self.get_url('branch/foo'))
39
48
        self.assertEqual(1, len(self.connections))
40
 
        self.assertEqual('foo', cmd.outf.getvalue())
 
49
        self.assertEqual('foo', self.outf.getvalue())
 
50