/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: Vincent Ladeuil
  • Date: 2008-05-05 18:16:46 UTC
  • mto: (487.1.1 gtk)
  • mto: This revision was merged to the branch mainline in revision 490.
  • Revision ID: v.ladeuil+lp@free.fr-20080505181646-n95l8ltw2u6jtr26
Fix bug #187283 fix replacing _() by _i18n().

* genpot.sh 
Remove duplication. Add the ability to specify the genrated pot
file on command-line for debugging purposes.

* po/olive-gtk.pot:
Regenerated.

* __init__.py, branch.py, branchview/treeview.py, checkout.py,
commit.py, conflicts.py, diff.py, errors.py, initialize.py,
merge.py, nautilus-bzr.py, olive/__init__.py, olive/add.py,
olive/bookmark.py, olive/guifiles.py, olive/info.py,
olive/menu.py, olive/mkdir.py, olive/move.py, olive/remove.py,
olive/rename.py, push.py, revbrowser.py, status.py, tags.py:
Replace all calls to _() by calls to _i18n(), the latter being
defined in __init__.py and imported in the other modules from
there. This fix the problem encountered countless times when
running bzr selftest and getting silly error messages about
boolean not being callables.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# -*- coding: utf-8 -*-
2
 
# Copyright (C) 2012 Curtis C. Hovey <sinzui.is@verizon.net>
3
 
#
4
 
# This program is free software; you can redistribute it and/or modify
5
 
# it under the terms of the GNU General Public License as published by
6
 
# the Free Software Foundation; either version 2 of the License, or
7
 
# (at your option) any later version.
8
 
#
9
 
# This program is distributed in the hope that it will be useful,
10
 
# but WITHOUT ANY WARRANTY; without even the implied warranty of
11
 
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
 
# GNU General Public License for more details.
13
 
#
14
 
# You should have received a copy of the GNU General Public License
15
 
# along with this program; if not, write to the Free Software
16
 
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17
 
 
18
 
import os
19
 
import subprocess
20
 
 
21
 
from bzrlib import tests
22
 
from bzrlib.plugins.gtk.notify import NotifyPopupMenu
23
 
 
24
 
 
25
 
class FakeNotifyPopupMenu(NotifyPopupMenu):
26
 
 
27
 
    SHOW_WIDGETS = False
28
 
 
29
 
 
30
 
class NotifyPopupMenuTestCase(tests.TestCase):
31
 
 
32
 
    def test_init(self):
33
 
        menu = FakeNotifyPopupMenu()
34
 
        items = menu.get_children()
35
 
        self.assertEqual(8, len(items))
36
 
        self.assertEqual('_Gateway to LAN', items[0].props.label)
37
 
        self.assertEqual('Announce _branches on LAN', items[2].props.label)
38
 
        self.assertEqual('gtk-preferences', items[4].props.label)
39
 
        self.assertEqual('gtk-about', items[5].props.label)
40
 
        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'))