Ejemplo n.º 1
0
def _get_translation(product, channel, locale, major_version_number=None):
    translation = utils.load_json_url(_LOCALE_URL.format(
        product=product, channel_or_major_version=channel, locale=locale
    ))

    # In the case of Release Candidates, we want to upload the name/descriptions of channels
    # (e.g.: "Firefox", but not "Firefox Beta"), but we want the "whatsnew" section of the expected
    # version (like "60")
    if major_version_number:
        version_specific_translation = utils.load_json_url(_LOCALE_URL.format(
            product=product, channel_or_major_version=major_version_number, locale=locale
        ))
        translation['whatsnew'] = version_specific_translation['whatsnew']

    return translation
Ejemplo n.º 2
0
def _get_list_of_completed_locales(product, channel):
    """ Get all the translated locales supported by Google play
    So, locale unsupported by Google play won't be downloaded
    Idem for not translated locale
    """
    return utils.load_json_url(
        _ALL_LOCALES_URL.format(product=product, channel=channel))
Ejemplo n.º 3
0
 def get_version_name(self):
     if self.latest_nightly:
         json = load_json_url(JSON_VERSION_URL)
         version_code = json['FIREFOX_NIGHTLY']
         return version_code
     return self.version
Ejemplo n.º 4
0
def _translate_moz_locate_into_google_play_one(locale):
    global _mappings
    if _mappings is None:
        _mappings = utils.load_json_url(_MAPPING_URL)

    return _mappings[locale] if locale in _mappings else locale
Ejemplo n.º 5
0
def _get_translation(product, channel, locale):
    return utils.load_json_url(
        _LOCALE_URL.format(product=product, channel=channel, locale=locale))
Ejemplo n.º 6
0
def test_load_json_url(monkeypatch):
    response_mock = MagicMock()
    response_mock.json = MagicMock()
    monkeypatch.setattr(requests, 'get', lambda url: response_mock)
    load_json_url('https://dummy-url.tld')
    response_mock.json.assert_called_once_with()
Ejemplo n.º 7
0
 def get_version_name(self):
     if self.config.latest_nightly:
         json = load_json_url(self.json_version_url)
         version_code = json['FIREFOX_NIGHTLY']
         return version_code
     return self.config.version