Example #1
0
 def diagnose(self):
     """Run diagnostics and return the results."""
     results = super().diagnose()
     results.extend([
         diagnose_url('http://localhost:5678', kind='4',
                      check_certificate=False),
         diagnose_url('http://localhost:5678', kind='6',
                      check_certificate=False),
         diagnose_url('http://{}:5678'.format(get_configured_domain_name()),
                      kind='4', check_certificate=False)
     ])
     return results
Example #2
0
def _diagnose_url_via_tor(url, kind=None):
    """Diagnose whether a URL is reachable via Tor."""
    result = diagnose_url(url, kind=kind, wrapper='torsocks')
    result[0] = _('Access URL {url} on tcp{kind} via Tor') \
        .format(url=url, kind=kind)

    return result
    def diagnose(self):
        """Run diagnostics and return the results."""
        results = super().diagnose()

        results.append(
            diagnose_url('http://diaspora.localhost', kind='4',
                         check_certificate=False))
        results.append(
            diagnose_url('http://diaspora.localhost', kind='6',
                         check_certificate=False))
        results.append(
            diagnose_url(
                'http://diaspora.{}'.format(get_configured_domain_name()),
                kind='4', check_certificate=False))

        return results
    def diagnose(self):
        """Run diagnostics and return the results."""
        results = super().diagnose()

        for domain in names.components.DomainName.list():
            if domain.domain_type.can_have_certificate:
                results.append(diagnose_url('https://' + domain.name))

        return results
Example #5
0
def test_diagnose_url(get_addresses, check):
    """Test diagnosing a URL."""
    args = {
        'url': 'https://localhost/test',
        'kind': '4',
        'env': {
            'test': 'value'
        },
        'check_certificate': False,
        'extra_options': {
            'test-1': 'value-1'
        },
        'wrapper': 'test-wrapper',
        'expected_output': 'test-expected'
    }
    check.return_value = 'passed'
    result = diagnose_url(**args)
    assert result == ['Access URL https://localhost/test on tcp4', 'passed']

    check.return_value = 'failed'
    result = diagnose_url(**args)
    assert result == ['Access URL https://localhost/test on tcp4', 'failed']

    del args['kind']
    args['url'] = 'https://{host}/test'
    check.return_value = 'passed'
    get_addresses.return_value = [{
        'kind': '4',
        'address': 'test-host-1',
        'numeric': False,
        'url_address': 'test-host-1'
    }, {
        'kind': '6',
        'address': 'test-host-2',
        'numeric': False,
        'url_address': 'test-host-2'
    }]
    result = diagnose_url_on_all(**args)
    assert result == [
        ['Access URL https://test-host-1/test on tcp4', 'passed'],
        ['Access URL https://test-host-2/test on tcp6', 'passed'],
    ]
Example #6
0
def _diagnose_tor_use(url, kind=None):
    """Diagnose whether webpage at URL reports that we are using Tor."""
    expected_output = 'Congratulations. This browser is configured to use Tor.'
    result = diagnose_url(url,
                          kind=kind,
                          wrapper='torsocks',
                          expected_output=expected_output)
    result[0] = _('Confirm Tor usage at {url} on tcp{kind}') \
        .format(url=url, kind=kind)

    return result
Example #7
0
    def diagnose(self):
        """Run diagnostics and return the results."""
        results = super().diagnose()

        for domain in names.components.DomainName.list():
            if domain.domain_type.can_have_certificate:
                results.append(diagnose_url('https://' + domain.name))

        if not results:
            results.append(
                (_('Cannot test: No domains are configured.'), 'warning'))

        return results
def diagnose_url_with_proxy():
    """Run a diagnostic on a URL with a proxy."""
    url = 'https://debian.org/'  # Gives a simple redirect to www.

    results = []
    for address in action_utils.get_addresses():
        proxy = 'http://{host}:8118/'.format(host=address['url_address'])
        env = {'https_proxy': proxy}

        result = diagnose_url(url, kind=address['kind'], env=env)
        result[0] = _('Access {url} with proxy {proxy} on tcp{kind}') \
            .format(url=url, proxy=proxy, kind=address['kind'])
        results.append(result)

    return results
 def diagnose(self):
     """Run diagnostics and return the results."""
     results = super().diagnose()
     results.append(diagnose_url('https://www.debian.org'))
     results.extend(diagnose_url_with_proxy())
     return results