/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_notify.py

  • Committer: Curtis Hovey
  • Date: 2012-02-03 18:59:38 UTC
  • mto: This revision was merged to the branch mainline in revision 773.
  • Revision ID: sinzui.is@verizon.net-20120203185938-ra0jl3b1rn69gmmz
Verify the menu and its items are created.

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
# along with this program; if not, write to the Free Software
16
16
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17
17
 
18
 
import os
19
 
import subprocess
 
18
from gi.repository import Gtk
20
19
 
21
20
from bzrlib import tests
22
21
from bzrlib.plugins.gtk.notify import NotifyPopupMenu
27
26
    SHOW_WIDGETS = False
28
27
 
29
28
 
 
29
# ['_Gateway to LAN', '', 'Announce _branches on LAN', '', 'gtk-preferences', 'gtk-about', '', 'gtk-quit']
 
30
 
30
31
class NotifyPopupMenuTestCase(tests.TestCase):
31
32
 
32
33
    def test_init(self):
38
39
        self.assertEqual('gtk-preferences', items[4].props.label)
39
40
        self.assertEqual('gtk-about', items[5].props.label)
40
41
        self.assertEqual('gtk-quit', items[7].props.label)
41
 
 
42
 
 
43
 
class BzrNotifyTestCase(tests.TestCase):
44
 
 
45
 
    def setUp(self):
46
 
        top = os.path.abspath(os.path.join(
47
 
            os.path.dirname(__file__), os.pardir))
48
 
        self.script = os.path.join(top, 'bzr-notify')
49
 
        self.env = dict(os.environ)
50
 
        self.env['BZR_PLUGINS_AT'] = 'gtk@%s' % top
51
 
        super(BzrNotifyTestCase, self).setUp()
52
 
 
53
 
    def test_smoketest(self):
54
 
        # This is a smoke test to verify the process starts.
55
 
        # The logic of the module must be moved into notify.py
56
 
        # where it can be properly tested.
57
 
        bzr_notify = subprocess.Popen(
58
 
            [self.script, 'test'],
59
 
            stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=self.env)
60
 
        stdout, stderr = bzr_notify.communicate()
61
 
        self.assertEqual('', stdout)
62
 
        self.assertTrue(
63
 
            stderr in (
64
 
            '', 'ERROR:root:Could not find any typelib for AppIndicator3\n'))