def test_configure_i18n_lang_none(self, locale):
        """
        Ensure the method i18n does not pass a None from the environment to Locale
        :return:
        """
        with patch.dict(os.environ, clear=True):
            try:
                configure_i18n()
            except:
                self.fail()

        locale.set.assert_not_called()
Example #2
0
    def test_configure_i18n_lang_none(self, locale):
        """
        Ensure the method i18n does not pass a None from the environment to Locale
        :return:
        """
        with patch.dict(os.environ, clear=True):
            try:
                configure_i18n()
            except Exception:
                self.fail()

        locale.set.assert_not_called()
Example #3
0
    def test_configure_i18n_lang(self, locale):
        """
        Ensure the method i18n does not pass a None from the environment to Locale
        :return:
        """
        new_lang = 'en-US.UTF-8'

        with patch.dict(os.environ, {'LANG': new_lang}):
            try:
                configure_i18n()
            except:
                self.fail()

        locale.set.assert_called_with(new_lang)
    def test_configure_i18n_lang(self, locale):
        """
        Ensure the method i18n does not pass a None from the environment to Locale
        :return:
        """
        new_lang = 'en-US.UTF-8'

        with patch.dict(os.environ, {'LANG': new_lang}):
            try:
                configure_i18n()
            except:
                self.fail()

        locale.set.assert_called_with(new_lang)
Example #5
0
    def test_configure_i18n_lang(self, locale):
        """
        Ensure the method i18n does not pass a None from the environment to Locale
        :return:
        """
        # This should be something that is listed in result of 'locale -a'
        new_lang = "en_US.UTF-8"

        with patch.dict(os.environ, {"LANG": new_lang}):
            try:
                configure_i18n()
            except Exception as err:
                self.fail(err)

        locale.set.assert_called_with(new_lang)
Example #6
0
 def test_configure_i18n(self):
     configure_i18n()
 def test_configure_i18n(self):
     configure_i18n()
    if msgs:
        if type(msgs) not in [type([]), type(())]:
            msgs = (msgs, )
        for msg in msgs:
            sys.stderr.write(str(msg) + '\n')
    sys.exit(code)

# quick check to see if you are a super-user.
if os.getuid() != 0:
    sys.stderr.write('Error: this command requires root access to execute\n')
    sys.exit(8)

try:
    # this has to be done first thing due to module level translated vars.
    from subscription_manager.i18n import configure_i18n
    configure_i18n()

    from subscription_manager import logutil
    logutil.init_logger()

    from subscription_manager.injectioninit import init_dep_injection
    init_dep_injection()

    import subscription_manager.injection as inj
    # Set up DBus mainloop via DBUS_IFACE
    inj.require(inj.DBUS_IFACE)

    from subscription_manager import managercli
    from subscription_manager.managercli import handle_exception

    from subscription_manager import ga_loader
# implied, including the implied warranties of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
# along with this software; if not, see
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
#
# Red Hat trademarks are not licensed under GPLv2. No permission is
# granted to use or replicate Red Hat trademarks that are incorporated
# in this software or its documentation.
#

import sys

sys.path.append("/usr/share/rhsm")
from subscription_manager.certlib import ConsumerIdentity
from subscription_manager.i18n import configure_i18n
configure_i18n(with_glade=True)

# Number of total RHSM firstboot screens, used to skip past to whatever's
# next in a couple places.
NUM_RHSM_SCREENS = 4

try:
    _version = "el6"
    from firstboot.constants import RESULT_SUCCESS, RESULT_FAILURE, RESULT_JUMP
    from firstboot.module import Module
except Exception:
    # we must be on el5
    _version = "el5"
    from firstboot_module_window import FirstbootModuleWindow

Example #10
0
from subscription_manager.injectioninit import init_dep_injection
init_dep_injection()

from subscription_manager import injection as inj

from subscription_manager.facts import Facts
from subscription_manager.hwprobe import Hardware
from subscription_manager.gui import managergui
from subscription_manager.gui import registergui
from subscription_manager.gui.utils import format_exception
from subscription_manager.i18n import configure_i18n

from firstboot import module
from firstboot import constants

configure_i18n(with_glade=True)

from rhsm.utils import remove_scheme

sys.path.append("/usr/share/rhn")
rhn_config = None

try:
    from up2date_client import config as rhn_config
except ImportError:
    log.debug("no rhn-client-tools modules could be imported")


class moduleClass(module.Module, object):

    def __init__(self):
Example #11
0
#
# Red Hat trademarks are not licensed under GPLv2. No permission is
# granted to use or replicate Red Hat trademarks that are incorporated
# in this software or its documentation.
#

# hack to allow bytes/strings to be interpolated w/ unicode values (gettext gives us bytes)
# Without this, for example, "Формат: %s\n" % "foobar" will fail with UnicodeDecodeError
# See http://stackoverflow.com/a/29832646/6124862 for more details
import sys

from subscription_manager.i18n import configure_i18n, ugettext as _
from rhsm import logutil
from rct.cli import RctCLI

configure_i18n()
logutil.init_logger()


def main():
    return RctCLI().main()


if __name__ == "__main__":
    try:
        sys.exit(abs(main() or 0))
    except SystemExit as err:
        # This is a non-exceptional exception thrown by Python 2.4, just
        # re-raise, bypassing handle_exception
        try:
            sys.stdout.flush()
 def test_configure_i18n_with_glade(self):
     configure_i18n(with_glade=True)
 def test_configure_i18n_without_glade(self):
     configure_i18n()
Example #14
0
 def test_configure_i18n_without_glade(self):
     configure_i18n()
Example #15
0
 def test_configure_i18n_with_glade(self):
     configure_i18n(with_glade=True)