示例#1
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']
示例#2
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']