예제 #1
0
def test_quote_symbol_bug():
    # A test to check if plus symbol handling has been fixed in the DHuS
    # https://github.com/SentinelDataHub/DataHubSystem/issues/23
    api = SentinelAPI(**_api_kwargs)

    q = 'beginposition:[2017-05-30T00:00:00Z TO 2017-05-31T00:00:00Z+1DAY]'
    with pytest.raises(SentinelAPIError) as excinfo:
        api._load_query(q, limit=0)
    assert excinfo.value.response.status_code == 500

    api._load_query(q.replace('+', '%2B'), limit=0)
    assert api._last_response.status_code == 200
예제 #2
0
def raw_products():
    """A fixture for tests that need some non-specific set of products in the form of a raw response as input."""
    api = SentinelAPI(**_api_auth)
    raw_products = api._load_query(
        api.format_query(geojson_to_wkt(read_geojson('tests/map.geojson')),
                         "20151219", "20151228"))
    return raw_products
예제 #3
0
def raw_products():
    """A fixture for tests that need some non-specific set of products in the form of a raw response as input."""
    api = SentinelAPI(**_api_auth)
    raw_products = api._load_query(api.format_query(
        geojson_to_wkt(read_geojson('tests/map.geojson')),
        "20151219", "20151228")
    )
    return raw_products
예제 #4
0
def raw_products(api_kwargs, vcr, test_wkt):
    """A fixture for tests that need some non-specific set of products in the form of a raw response as input."""
    with vcr.use_cassette("products_fixture",
                          decode_compressed_response=False):
        api = SentinelAPI(**api_kwargs)
        raw_products = api._load_query(
            api.format_query(test_wkt, ("20151219", "20151228")))[0]
    return raw_products
예제 #5
0
def raw_products(api_kwargs, vcr, test_wkt):
    """A fixture for tests that need some non-specific set of products in the form of a raw response as input."""
    with vcr.use_cassette('products_fixture', decode_compressed_response=False):
        api = SentinelAPI(**api_kwargs)
        raw_products = api._load_query(
            api.format_query(test_wkt, ("20151219", "20151228"))
        )[0]
    return raw_products
예제 #6
0
def raw_products():
    """A fixture for tests that need some non-specific set of products in the form of a raw response as input."""
    api = SentinelAPI(**_api_auth)
    with my_vcr.use_cassette('products_fixture',
                             decode_compressed_response=False):
        raw_products = api._load_query(
            api.format_query(
                geojson_to_wkt(read_geojson(FIXTURES_DIR + '/map.geojson')),
                ("20151219", "20151228")))[0]
    return raw_products