示例#1
0
def test_update_safe_id(fixture, config):
    p = GeoJSONProvider(config)
    new_feature = {
        'type': 'Feature',
        'geometry': {
            'type': 'Point',
            'coordinates': [0.0, 0.0]},
        'properties': {
            'id': 'SOMETHING DIFFERENT',
            'name': 'Null Island'}}

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

    # Don't let the id change, should not exist
    assert p.get('SOMETHING DIFFERENT') is None

    # Should still be at the old id
    results = p.get('123-456')
    assert 'Null' in results['properties']['name']
示例#2
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']
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']
示例#5
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']