/b-gtk/fix-viz

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/b-gtk/fix-viz

« back to all changes in this revision

Viewing changes to tests/test_push.py

  • Committer: Curtis Hovey
  • Date: 2012-03-03 22:35:57 UTC
  • mto: This revision was merged to the branch mainline in revision 782.
  • Revision ID: sinzui.is@verizon.net-20120303223557-f661k0jm4vme3ge8
Added test for _build_history.

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
    MockMethod,
30
30
    MockProperty,
31
31
    )
 
32
from bzrlib.plugins.gtk.history import UrlHistory
32
33
from bzrlib.plugins.gtk.ui import ProgressPanel
33
34
 
34
35
 
35
36
class PushTestCase(tests.TestCaseWithMemoryTransport):
36
37
 
 
38
    def make_push_branch(self):
 
39
        tree = self.make_branch_and_memory_tree('test')
 
40
        tree.branch.set_push_location('lp:~user/fnord/trunk')
 
41
        return tree.branch
 
42
 
37
43
    def test_init(self):
38
 
        tree = self.make_branch_and_memory_tree('test')
39
 
        branch = tree.branch
40
44
        set_ui_factory()
 
45
        branch = self.make_push_branch()
41
46
        dialog = PushDialog(
42
47
            repository=None, revid=None, branch=branch, parent=None)
43
48
        self.assertIs(None, dialog.props.parent)
61
66
        self.assertIs(True, dialog._combo.props.visible)
62
67
        self.assertIs(False, dialog._progress_widget.props.visible)
63
68
        self.assertIs(False, dialog._push_message.props.visible)
 
69
        self.assertIsInstance(dialog._history, UrlHistory)
 
70
 
 
71
    def test_build_history(self):
 
72
        set_ui_factory()
 
73
        branch = self.make_push_branch()
 
74
        dialog = PushDialog(None, None, branch)
 
75
        dialog._history.add_entry('lp:~user/fnord/test1')
 
76
        dialog._history.add_entry('lp:~user/fnord/test2')
 
77
        dialog._build_history()
 
78
        self.assertEqual(
 
79
            'lp:~user/fnord/trunk', dialog._combo.get_child().props.text)
 
80
        self.assertIsInstance(dialog._combo_model, Gtk.ListStore)
 
81
        self.assertIs(dialog._combo.get_model(), dialog._combo_model)
 
82
        locations = [row[0] for row in dialog._combo_model]
 
83
        self.assertEqual(
 
84
            ['lp:~user/fnord/test1', 'lp:~user/fnord/test2'], locations)