Beispiel #1
0
def test_query(fixture, config):
    p = GeoJSONProvider(config)
    results = p.query()
    assert len(results['features']) == 1
    assert results['numberMatched'] == 1
    assert results['numberReturned'] == 1
    assert results['features'][0]['properties']['id'] == '123-456'
def test_query(fixture, config):
    p = GeoJSONProvider(config)

    fields = p.get_fields()
    assert len(fields) == 1
    assert fields['name'] == 'string'

    results = p.query()
    assert len(results['features']) == 1
    assert results['numberMatched'] == 1
    assert results['numberReturned'] == 1
    assert results['features'][0]['id'] == '123-456'
Beispiel #3
0
def test_update(fixture, config):
    p = GeoJSONProvider(config)
    new_feature = {
        'type': 'Feature',
        'geometry': {
            'type': 'Point',
            'coordinates': [0.0, 0.0]},
        'properties': {
            'id': '123-456',
            'name': 'Null Island'}}

    p.update('123-456', new_feature)

    # Should be changed
    results = p.get('123-456')
    assert 'Null' in results['properties']['name']
Beispiel #4
0
def test_create(fixture, config):
    p = GeoJSONProvider(config)
    new_feature = {
        'type': 'Feature',
        'id': '123-456',
        'geometry': {
            'type': 'Point',
            'coordinates': [0.0, 0.0]},
        'properties': {
            'name': 'Null Island'}}

    p.create(new_feature)

    results = p._load()
    assert len(results['features']) == 2
    assert 'Dinagat' in results['features'][0]['properties']['name']
    assert 'Null' in results['features'][1]['properties']['name']
Beispiel #5
0
def test_update_safe_id(fixture, config):
    p = GeoJSONProvider(config)
    new_feature = {
        'type': 'Feature',
        'id': 'SOMETHING DIFFERENT',
        'geometry': {
            'type': 'Point',
            'coordinates': [0.0, 0.0]},
        'properties': {
            'name': 'Null Island'}}

    p.update('123-456', new_feature)

    # Don't let the id change, should not exist
    with pytest.raises(Exception):
        p.get('SOMETHING DIFFERENT')

    # Should still be at the old id
    results = p.get('123-456')
    assert 'Null' in results['features'][0]['properties']['name']
def test_query(fixture, config):
    p = GeoJSONProvider(config)

    fields = p.get_fields()
    assert len(fields) == 2
    assert fields['name']['type'] == 'string'

    results = p.query()
    assert len(results['features']) == 1
    assert results['numberMatched'] == 1
    assert results['numberReturned'] == 1
    assert results['features'][0]['id'] == '123-456'

    results = p.query(select_properties=['foo'])
    assert len(results['features'][0]['properties']) == 1

    results = p.query(skip_geometry=True)
    assert results['features'][0]['geometry'] is None
def test_delete(fixture, config):
    p = GeoJSONProvider(config)
    p.delete('123-456')

    results = p.query()
    assert len(results['features']) == 0
def test_get_not_existing_item_raise_exception(fixture, config):
    """Testing query for a not existing object"""
    p = GeoJSONProvider(config)
    with pytest.raises(ProviderItemNotFoundError):
        p.get(-1)
def test_get(fixture, config):
    p = GeoJSONProvider(config)
    results = p.get('123-456')
    assert isinstance(results, dict)
    assert 'Dinagat' in results['properties']['name']
Beispiel #10
0
def test_get(fixture, config):
    p = GeoJSONProvider(config)
    results = p.get('123-456')
    assert len(results['features']) == 1
    assert 'Dinagat' in results['features'][0]['properties']['name']
Beispiel #11
0
def test_query(fixture, config):
    p = GeoJSONProvider(config)
    results = p.query()
    assert len(results['features']) == 1
    assert results['features'][0]['id'] == '123-456'