def test_fix_turkish_locale_when_LC_CTYPE_is_turkish(self):
     """The fix is applied if the LC_CTYPE is turkish."""
     locale.os.environ["LANG"] = "es_ES.UTF-8"
     locale.os.environ["LC_CTYPE"] = "tr_TR.UTF-8"
     locale.fix_turkish_locale()
     self.assertEqual(locale.os.environ.get("LC_CTYPE", NO_VALUE),
                      locale.SAFE_LOCALE)
 def test_fix_turkish_locale_when_LC_CTYPE_not_turkish(self):
     """The fix is skipped if the LC_CTYPE is already non-turkish."""
     original = "es_ES.UTF-8"
     locale.os.environ["LANG"] = "tr_TR.UTF-8"
     locale.os.environ["LC_CTYPE"] = original
     locale.fix_turkish_locale()
     self.assertEqual(locale.os.environ.get("LC_CTYPE", NO_VALUE), original)
def main(argv):
    """The main function for the tunnel server."""
    fix_turkish_locale()
    if not check_proxy_enabled(*argv[1:]):
        sys.stdout.write("Proxy not enabled.")
        sys.stdout.flush()
    else:
        if sys.platform.startswith("linux"):
            install_qt_dbus()

        app = QCoreApplication(argv)
        cookie = str(uuid.uuid4())
        tunnel_server = TunnelServer(cookie)
        sys.stdout.write(
            "%s: %d\n" % (TUNNEL_PORT_LABEL, tunnel_server.port) + "%s: %s\n" % (TUNNEL_COOKIE_LABEL, cookie)
        )
        sys.stdout.flush()
        app.exec_()
 def test_fix_turkish_locale_when_LANG_unset(self):
     """The fix_turkish_locale function skips when no locale set."""
     del(locale.os.environ["LANG"])
     del(locale.os.environ["LC_CTYPE"])
     locale.fix_turkish_locale()
     self.assertEqual(locale.os.environ.get("LC_CTYPE", NO_VALUE), NO_VALUE)
 def test_fix_turkish_locale_when_turkish(self):
     """The fix_turkish_locale function skips when no locale set."""
     locale.os.environ["LANG"] = "tr_TR.UTF-8"
     del(locale.os.environ["LC_CTYPE"])
     locale.fix_turkish_locale()
     self.assertEqual(locale.os.environ["LC_CTYPE"], locale.SAFE_LOCALE)