1
# Copyright (C) 2009, 2010, 2011, 2016 Canonical Ltd
1
# Copyright (C) 2009, 2010, 2011 Canonical Ltd
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
59
59
def test_be_quiet(self):
60
60
self.factory.be_quiet(True)
61
self.assertEqual(True, self.factory.is_quiet())
61
self.assertEquals(True, self.factory.is_quiet())
62
62
self.factory.be_quiet(False)
63
self.assertEqual(False, self.factory.is_quiet())
63
self.assertEquals(False, self.factory.is_quiet())
65
65
def test_confirm_action(self):
66
66
# confirm_action should be answered by every ui factory; even
72
72
# will be true either because we read it from the input or because
73
73
# that's the default
74
self.assertEqual(result, True)
74
self.assertEquals(result, True)
76
76
def test_note(self):
77
77
self.factory.note("a note to the user")
101
101
def test_transport_activity(self):
102
102
# It doesn't matter what the implementation does, we just want to make
103
103
# sure the interface is there
104
t = transport.get_transport_from_url('memory:///')
104
t = transport.get_transport('memory:///')
105
105
self.factory.report_transport_activity(t, 1000, 'write')
106
106
self.factory.report_transport_activity(t, 2000, 'read')
107
107
self.factory.report_transport_activity(t, 4000, None)
113
113
def test_no_transport_activity(self):
114
114
# No activity to report
115
t = transport.get_transport_from_url('memory:///')
115
t = transport.get_transport('memory:///')
116
116
self.factory.log_transport_activity(display=True)
117
117
self._check_log_transport_activity_display_no_bytes()
130
130
def _check_note(self, note_text):
131
self.assertEqual("%s\n" % note_text,
131
self.assertEquals("%s\n" % note_text,
132
132
self.stdout.getvalue())
134
134
def _check_show_error(self, msg):
135
self.assertEqual("bzr: error: %s\n" % msg,
135
self.assertEquals("bzr: error: %s\n" % msg,
136
136
self.stderr.getvalue())
137
self.assertEqual("", self.stdout.getvalue())
137
self.assertEquals("", self.stdout.getvalue())
139
139
def _check_show_message(self, msg):
140
self.assertEqual("%s\n" % msg,
140
self.assertEquals("%s\n" % msg,
141
141
self.stdout.getvalue())
142
self.assertEqual("", self.stderr.getvalue())
142
self.assertEquals("", self.stderr.getvalue())
144
144
def _check_show_warning(self, msg):
145
self.assertEqual("bzr: warning: %s\n" % msg,
145
self.assertEquals("bzr: warning: %s\n" % msg,
146
146
self.stderr.getvalue())
147
self.assertEqual("", self.stdout.getvalue())
147
self.assertEquals("", self.stdout.getvalue())
149
149
def _check_log_transport_activity_noarg(self):
150
150
self.assertEqual('', self.stdout.getvalue())