Exemplo n.º 1
0
def test_i18n_app(mock_gettext):
    provider = 'netshow-linux'
    translate_mock = mock.MagicMock()
    mock_gettext.return_value = translate_mock
    _result = netshow.i18n_app(provider)
    # check that it calls the right path to the .mo files

    install_location = pkg_resources.require('netshow-core-lib')[0].location
    mock_gettext.assert_called_with(provider, os.path.join(
        install_location, '..', '..', '..', 'share', 'locale'), fallback=True)
    # check that it calls the right gettext function. In this
    # case should be lgettext
    assert_equals(_result._mock_name, 'lgettext')
Exemplo n.º 2
0
# pylint: disable=E0611
from netshow.netshow import i18n_app
from tabulate import tabulate

_ = i18n_app('netshow-linux-lib')


def legend():
    """
    :return: print a legend explaining what the carrier state and bond information means
    """
    _table = []
    _table.append([_('legend') + ':', ''])
    _table.append([_('UP') + ':', _('carrier up')])
    _table.append([_('UN') + ':', _('carrier up, bond member not in bond')])
    _table.append([_('DN') + ':', _('carrier down')])
    _table.append([
        _('ADMDN') + ':',
        _('admin down use "ip link set <iface> up" to initialize')
    ])
    _table.append([_('DRMNT') + ':', _('carrier up, link dormant')])
    return '\n' + tabulate(_table) + '\n'


def one_line_legend(show_legend=False):
    """
    :return: string informing user where to find legend.
    only shown if legend option is not enabled
    """
    if not show_legend:
        return tabulate([[_('Legend: for abbrev example use -l opt in netshow cmd')]]) + \
Exemplo n.º 3
0
# pylint: disable=E0611
from netshow.netshow import i18n_app
from tabulate import tabulate

_ = i18n_app('netshow-linux-lib')


def legend():
    """
    :return: print a legend explaining what the carrier state and bond information means
    """
    _table = []
    _table.append([_('legend') + ':', ''])
    _table.append([_('UP') + ':',
                   _('carrier up')])
    _table.append([_('UN') + ':',
                   _('carrier up, bond member not in bond')])
    _table.append([_('DN') + ':',
                   _('carrier down')])
    _table.append([_('ADMDN') + ':',
                   _('admin down use "ip link set <iface> up" to initialize')])
    _table.append([_('DRMNT') + ':',
                   _('carrier up, link dormant')])
    return '\n' + tabulate(_table) + '\n'


def one_line_legend(show_legend=False):
    """
    :return: string informing user where to find legend.
    only shown if legend option is not enabled
    """
Exemplo n.º 4
0
# pylint: disable=E0611
from netshow.netshow import i18n_app

_ = i18n_app('netshow-cumulus-lib')