<commit_before># This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

from bs4 import BeautifulSoup
import pytest
import requests


PAGE_PATHS = (
    '/firefox/all/',
    '/firefox/beta/all/',
    '/firefox/developer/all/',
    '/firefox/nightly/all/',
    '/firefox/organizations/all/',
    '/firefox/android/all/',
    '/firefox/android/beta/all/',
    '/firefox/android/nightly/all/',
)

TIMEOUT = 60


@pytest.mark.download
@pytest.mark.nondestructive
@pytest.mark.parametrize('path', PAGE_PATHS)
def test_localized_download_links(path, base_url):
    if not base_url:
        pytest.skip(
            'This test requires a base URL to be specified on the command '
            'line or in a configuration file.')

    full_url = base_url + '/en-US' + path
    try:
        r = requests.get(full_url, timeout=TIMEOUT)
    except requests.RequestException:
        # retry
        r = requests.get(full_url, timeout=TIMEOUT)
    soup = BeautifulSoup(r.content, 'html.parser')
    table = soup.find('table', class_='build-table')
    urls = [a['href'] for a in table.find_all('a')]
    assert urls
    for url in urls:
        r = requests.head(url, allow_redirects=True, timeout=TIMEOUT)
        assert requests.codes.ok == r.status_code<commit_msg>Temporarily skip 404 download link test<commit_after># This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

from bs4 import BeautifulSoup
import pytest
import requests


PAGE_PATHS = (
    '/firefox/all/',
    '/firefox/beta/all/',
    '/firefox/developer/all/',
    '/firefox/nightly/all/',
    '/firefox/organizations/all/',
    '/firefox/android/all/',
    '/firefox/android/beta/all/',
    '/firefox/android/nightly/all/',
)

TIMEOUT = 60


@pytest.mark.download
@pytest.mark.nondestructive
@pytest.mark.parametrize('path', PAGE_PATHS)
def test_localized_download_links(path, base_url):
    if not base_url:
        pytest.skip(
            'This test requires a base URL to be specified on the command '
            'line or in a configuration file.')

    full_url = base_url + '/en-US' + path
    try:
        r = requests.get(full_url, timeout=TIMEOUT)
    except requests.RequestException:
        # retry
        r = requests.get(full_url, timeout=TIMEOUT)
    soup = BeautifulSoup(r.content, 'html.parser')
    table = soup.find('table', class_='build-table')
    urls = [a['href'] for a in table.find_all('a')]
    # Bug 1552228 skip broken dev edition link for 'as' until bug is resolved
    urls = [url for url in urls if 'product=firefox-devedition-latest-ssl&os=win64&lang=as' not in url]
    assert urls
    for url in urls:
        r = requests.head(url, allow_redirects=True, timeout=TIMEOUT)
        assert requests.codes.ok == r.status_code
{'fraction_non_alphanumeric': 0.12250332889480692, 'fraction_numerical': 0.008655126498002663, 'mean_word_length': 3.0227576974564925, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 5, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7135550', 'n_tokens_mistral': 1013, 'n_tokens_neox': 1001, 'n_words': 272}