This file is indexed.

/usr/lib/python3/dist-packages/pydap/tests/test_cas_urs.py is in python3-pydap 3.2.2+ds1-1ubuntu1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
from pydap.client import open_url
from pydap.cas import urs
import pydap.net
import requests
import os
import pytest


url = ('https://goldsmr3.gesdisc.eosdis.nasa.gov/opendap/'
       'MERRA_MONTHLY/MAIMCPASM.5.2.0/1979/'
       'MERRA100.prod.assim.instM_3d_asm_Cp.197901.hdf')
test_url = url + '.dods?SLP[0:1:0][0:1:10][0:1:10]'
test_url_2 = url + '.dods?PS[0:1:0][0:1:10][0:1:10]'


@pytest.mark.auth
@pytest.mark.prod_url
@pytest.mark.skipif(not (os.environ.get('USERNAME_URS') and
                         os.environ.get('PASSWORD_URS')),
                    reason=('Without auth credentials, '
                            'this test cannot work'))
def test_basic_urs_auth():
    """
    Set up PyDAP to use the URS request() function.

    The intent here is to ensure that pydap.net is able to
    open and url if and only if requests is able to
    open the same url.
    """
    session = urs.setup_session(os.environ.get('USERNAME_URS'),
                                os.environ.get('PASSWORD_URS'),
                                check_url=url)

    # Check that the requests library can access the link:
    res = requests.get(test_url, cookies=session.cookies)
    assert(res.status_code == 200)
    res.close()

    # Check that the pydap library can access the link:
    res = pydap.net.follow_redirect(test_url, session=session)
    assert(res.status_code == 200)

    # Check that the pydap library can access another link:
    res = pydap.net.follow_redirect(test_url_2, session=session)
    assert(res.status_code == 200)
    session.close()


@pytest.mark.auth
@pytest.mark.prod_url
@pytest.mark.skipif(not (os.environ.get('USERNAME_URS') and
                         os.environ.get('PASSWORD_URS')),
                    reason=('Without auth credentials, '
                            'this test cannot work'))
def test_basic_urs_query():
    session = urs.setup_session(os.environ.get('USERNAME_URS'),
                                os.environ.get('PASSWORD_URS'),
                                check_url=url)
    # Ensure authentication:
    res = pydap.net.follow_redirect(test_url, session=session)
    assert(res.status_code == 200)
    dataset = open_url(url, session=session)
    expected_data = [[[99066.15625, 99066.15625, 99066.15625,
                       99066.15625, 99066.15625],
                      [98868.15625, 98870.15625, 98872.15625,
                       98874.15625, 98874.15625],
                      [98798.15625, 98810.15625, 98820.15625,
                       98832.15625, 98844.15625],
                      [98856.15625, 98828.15625, 98756.15625,
                       98710.15625, 98776.15625],
                      [99070.15625, 99098.15625, 99048.15625,
                       98984.15625, 99032.15625]]]
    assert((dataset['SLP'][0, :5, :5] == expected_data).all())
    session.close()