Exemple #1
0
def test_analyse_verify_editor_id_unknown_instance():
    """Test if iD is not a powerfull_editor and if 'Unknown iD instance' is added
    to suspicion_reasons.
    """
    ch_dict = {
        'created_by':
        'iD 1.7.3',
        'host':
        'http://anotherhost.com',
        'created_at':
        '2015-04-25T18:08:46Z',
        'comment':
        'add pois',
        'id':
        '1',
        'user':
        '******',
        'uid':
        '123123',
        'bbox':
        Polygon([(-71.0646843, 44.2371354), (-71.0048652, 44.2371354),
                 (-71.0048652, 44.2430624), (-71.0646843, 44.2430624),
                 (-71.0646843, 44.2371354)])
    }
    ch = Analyse(ch_dict)
    ch.verify_editor()
    assert ch.powerfull_editor is False
    assert 'Unknown iD instance' in ch.suspicion_reasons
    assert ch.is_suspect
Exemple #2
0
def test_analyse_verify_editor_rapid_test():
    """Test if RapiD test is not a powerfull_editor and a trusted instance."""
    ch_dict = {
        'created_by':
        'RapiD 0.9.0',
        'host':
        'https://mapwith.ai/rapidtest',
        'created_at':
        '2015-04-25T18:08:46Z',
        'comment':
        'add pois',
        'id':
        '1',
        'user':
        '******',
        'uid':
        '123123',
        'bbox':
        Polygon([(-71.0646843, 44.2371354), (-71.0048652, 44.2371354),
                 (-71.0048652, 44.2430624), (-71.0646843, 44.2430624),
                 (-71.0646843, 44.2371354)])
    }
    ch = Analyse(ch_dict)
    ch.verify_editor()
    assert ch.powerfull_editor is False
    assert ch.suspicion_reasons == []
Exemple #3
0
def test_analyse_verify_editor_id_improveosm():
    """Test if iD is not a powerfull_editor and if https://strava.github.io/iD/
    is a trusted instance.
    """
    ch_dict = {
        'created_by':
        'iD 1.7.3',
        'host':
        'https://strava.github.io/iD/',
        'created_at':
        '2015-04-25T18:08:46Z',
        'comment':
        'add pois',
        'id':
        '1',
        'user':
        '******',
        'uid':
        '123123',
        'bbox':
        Polygon([(-71.0646843, 44.2371354), (-71.0048652, 44.2371354),
                 (-71.0048652, 44.2430624), (-71.0646843, 44.2430624),
                 (-71.0646843, 44.2371354)])
    }
    ch = Analyse(ch_dict)
    ch.verify_editor()
    assert ch.powerfull_editor is False
    assert ch.suspicion_reasons == []
Exemple #4
0
def test_analyse_verify_editor_Potlatch2():
    """Test if Potlatch 2 is not a powerfull_editor."""
    ch_dict = {
        'created_by':
        'Potlatch 2',
        'created_at':
        '2015-04-25T18:08:46Z',
        'comment':
        'add pois',
        'comments_count':
        '0',
        'id':
        '1',
        'user':
        '******',
        'uid':
        '123123',
        'bbox':
        Polygon([(-71.0646843, 44.2371354), (-71.0048652, 44.2371354),
                 (-71.0048652, 44.2430624), (-71.0646843, 44.2430624),
                 (-71.0646843, 44.2371354)])
    }
    ch = Analyse(ch_dict)
    ch.verify_editor()
    assert ch.powerfull_editor is False
Exemple #5
0
def test_verify_id_editor_amazon_is_known_instance():
    """Test if iD is not a powerfull_editor and if 'Unknown iD instance' is added
    to suspicion_reasons.
    """
    ch_dict = {
        'created_by':
        'iD 2.17.3',
        'host':
        'https://ideditor.amazon.com/',
        'created_at':
        '2020-09-25T18:08:46Z',
        'comment':
        'add pois',
        'comments_count':
        '4',
        'id':
        '1',
        'user':
        '******',
        'uid':
        '123123',
        'bbox':
        Polygon([(-71.0646843, 44.2371354), (-71.0048652, 44.2371354),
                 (-71.0048652, 44.2430624), (-71.0646843, 44.2430624),
                 (-71.0646843, 44.2371354)])
    }
    ch = Analyse(ch_dict)
    ch.verify_editor()
    assert ch.powerfull_editor is False
    assert 'Unknown iD instance' not in ch.suspicion_reasons
    assert ch.is_suspect is False
Exemple #6
0
def test_analyse_verify_editor_josm():
    """Test if JOSM is a powerfull_editor."""
    ch_dict = {
        'created_by':
        'JOSM/1.5 (8339 en)',
        'created_at':
        '2015-04-25T18:08:46Z',
        'comment':
        'add pois',
        'comments_count':
        '3',
        'id':
        '1',
        'user':
        '******',
        'uid':
        '123123',
        'bbox':
        Polygon([(-71.0646843, 44.2371354), (-71.0048652, 44.2371354),
                 (-71.0048652, 44.2430624), (-71.0646843, 44.2430624),
                 (-71.0646843, 44.2371354)])
    }
    ch = Analyse(ch_dict)
    ch.verify_editor()
    assert ch.powerfull_editor
Exemple #7
0
def test_verify_hotosm_id_is_known_instance():
    """Test if iD is not a powerfull_editor and if 'Unknown iD instance' is added
    to suspicion_reasons.
    """
    ch1 = {
        'created_by':
        'iD 1.7.3',
        'host':
        'https://tasks.teachosm.org/projects/23/map/',
        'created_at':
        '2015-04-25T18:08:46Z',
        'comment':
        'add pois',
        'comments_count':
        '0',
        'id':
        '1',
        'user':
        '******',
        'uid':
        '123123',
        'bbox':
        Polygon([(-71.0646843, 44.2371354), (-71.0048652, 44.2371354),
                 (-71.0048652, 44.2430624), (-71.0646843, 44.2430624),
                 (-71.0646843, 44.2371354)])
    }
    ch2 = {
        'created_by':
        'iD 1.7.3',
        'host':
        'https://tasks.hotosm.org/projects/23/map/',
        'created_at':
        '2015-04-25T18:08:46Z',
        'comment':
        'add pois',
        'comments_count':
        '1',
        'id':
        '1',
        'user':
        '******',
        'uid':
        '123123',
        'bbox':
        Polygon([(-71.0646843, 44.2371354), (-71.0048652, 44.2371354),
                 (-71.0048652, 44.2430624), (-71.0646843, 44.2430624),
                 (-71.0646843, 44.2371354)])
    }
    ch = Analyse(ch1)
    ch.verify_editor()
    assert ch.powerfull_editor is False
    assert 'Unknown iD instance' not in ch.suspicion_reasons
    assert ch.is_suspect is False
    ch_2 = Analyse(ch2)
    ch_2.verify_editor()
    assert ch_2.powerfull_editor is False
    assert 'Unknown iD instance' not in ch_2.suspicion_reasons
    assert ch_2.is_suspect is False
Exemple #8
0
def test_analyse_verify_editor_Potlatch2():
    """Test if Potlatch 2 is not a powerfull_editor."""
    ch_dict = {
        'created_by': 'Potlatch 2',
        'created_at': '2015-04-25T18:08:46Z',
        'comment': 'add pois',
        'id': '1',
        'user': '******',
        'uid': '123123',
        'bbox': Polygon([
            (-71.0646843, 44.2371354), (-71.0048652, 44.2371354),
            (-71.0048652, 44.2430624), (-71.0646843, 44.2430624),
            (-71.0646843, 44.2371354)
            ])
        }
    ch = Analyse(ch_dict)
    ch.verify_editor()
    assert ch.powerfull_editor is False
Exemple #9
0
def test_analyse_verify_editor_josm():
    """Test if JOSM is a powerfull_editor."""
    ch_dict = {
        'created_by': 'JOSM/1.5 (8339 en)',
        'created_at': '2015-04-25T18:08:46Z',
        'comment': 'add pois',
        'id': '1',
        'user': '******',
        'uid': '123123',
        'bbox': Polygon([
            (-71.0646843, 44.2371354), (-71.0048652, 44.2371354),
            (-71.0048652, 44.2430624), (-71.0646843, 44.2430624),
            (-71.0646843, 44.2371354)
            ])
        }
    ch = Analyse(ch_dict)
    ch.verify_editor()
    assert ch.powerfull_editor
Exemple #10
0
def test_analyse_verify_editor_merkaartor():
    """Test if Merkaartor is a powerfull_editor."""
    ch_dict = {
        'created_by': 'Merkaartor 0.18 (de)',
        'created_at': '2015-04-25T18:08:46Z',
        'comment': 'add pois',
        'id': '1',
        'user': '******',
        'uid': '123123',
        'bbox': Polygon([
            (-71.0646843, 44.2371354), (-71.0048652, 44.2371354),
            (-71.0048652, 44.2430624), (-71.0646843, 44.2430624),
            (-71.0646843, 44.2371354)
            ])
        }
    ch = Analyse(ch_dict)
    ch.verify_editor()
    assert ch.powerfull_editor
Exemple #11
0
def test_analyse_verify_editor_id_strava():
    """Test if iD is not a powerfull_editor and if https://strava.github.io/iD/
    is a trusted instance.
    """
    ch_dict = {
        'created_by': 'iD 1.7.3',
        'host': 'https://strava.github.io/iD/',
        'created_at': '2015-04-25T18:08:46Z',
        'comment': 'add pois',
        'id': '1',
        'user': '******',
        'uid': '123123',
        'bbox': Polygon([
            (-71.0646843, 44.2371354), (-71.0048652, 44.2371354),
            (-71.0048652, 44.2430624), (-71.0646843, 44.2430624),
            (-71.0646843, 44.2371354)
            ])
        }
    ch = Analyse(ch_dict)
    ch.verify_editor()
    assert ch.powerfull_editor is False
    assert ch.suspicion_reasons == []
Exemple #12
0
def test_analyse_verify_editor_id_unknown_instance():
    """Test if iD is not a powerfull_editor and if 'Unknown iD instance' is added
    to suspicion_reasons.
    """
    ch_dict = {
        'created_by': 'iD 1.7.3',
        'host': 'http://anotherhost.com',
        'created_at': '2015-04-25T18:08:46Z',
        'comment': 'add pois',
        'id': '1',
        'user': '******',
        'uid': '123123',
        'bbox': Polygon([
            (-71.0646843, 44.2371354), (-71.0048652, 44.2371354),
            (-71.0048652, 44.2430624), (-71.0646843, 44.2430624),
            (-71.0646843, 44.2371354)
            ])
        }
    ch = Analyse(ch_dict)
    ch.verify_editor()
    assert ch.powerfull_editor is False
    assert 'Unknown iD instance' in ch.suspicion_reasons
    assert ch.is_suspect
Exemple #13
0
def test_analyse_verify_editor():
    ch_dict = {
        'created_by': 'JOSM/1.5 (8339 en)',
        'created_at': '2015-04-25T18:08:46Z',
        'comment': 'add pois',
        'id': '1',
        'user': '******',
        'uid': '123123',
        'bbox': Polygon([
            (-71.0646843, 44.2371354), (-71.0048652, 44.2371354),
            (-71.0048652, 44.2430624), (-71.0646843, 44.2430624),
            (-71.0646843, 44.2371354)
        ])
    }
    ch = Analyse(ch_dict)
    ch.verify_editor()
    assert ch.powerfull_editor

    ch_dict = {
        'created_by': 'Merkaartor 0.18 (de)',
        'created_at': '2015-04-25T18:08:46Z',
        'comment': 'add pois',
        'id': '1',
        'user': '******',
        'uid': '123123',
        'bbox': Polygon([
            (-71.0646843, 44.2371354), (-71.0048652, 44.2371354),
            (-71.0048652, 44.2430624), (-71.0646843, 44.2430624),
            (-71.0646843, 44.2371354)
        ])
    }
    ch = Analyse(ch_dict)
    ch.verify_editor()
    assert ch.powerfull_editor

    ch_dict = {
        'created_by': 'Level0 v1.1',
        'created_at': '2015-04-25T18:08:46Z',
        'comment': 'add pois',
        'id': '1',
        'user': '******',
        'uid': '123123',
        'bbox': Polygon([
            (-71.0646843, 44.2371354), (-71.0048652, 44.2371354),
            (-71.0048652, 44.2430624), (-71.0646843, 44.2430624),
            (-71.0646843, 44.2371354)
        ])
    }
    ch = Analyse(ch_dict)
    ch.verify_editor()
    assert ch.powerfull_editor

    ch_dict = {
        'created_by': 'QGIS plugin',
        'created_at': '2015-04-25T18:08:46Z',
        'comment': 'add pois',
        'id': '1',
        'user': '******',
        'uid': '123123',
        'bbox': Polygon([
            (-71.0646843, 44.2371354), (-71.0048652, 44.2371354),
            (-71.0048652, 44.2430624), (-71.0646843, 44.2430624),
            (-71.0646843, 44.2371354)
        ])
    }
    ch = Analyse(ch_dict)
    ch.verify_editor()
    assert ch.powerfull_editor

    ch_dict = {
        'created_by': 'iD 1.7.3',
        'created_at': '2015-04-25T18:08:46Z',
        'comment': 'add pois',
        'id': '1',
        'user': '******',
        'uid': '123123',
        'bbox': Polygon([
            (-71.0646843, 44.2371354), (-71.0048652, 44.2371354),
            (-71.0048652, 44.2430624), (-71.0646843, 44.2430624),
            (-71.0646843, 44.2371354)
        ])
    }
    ch = Analyse(ch_dict)
    ch.verify_editor()
    assert ch.powerfull_editor is False

    ch_dict = {
        'created_by': 'Potlatch 2',
        'created_at': '2015-04-25T18:08:46Z',
        'comment': 'add pois',
        'id': '1',
        'user': '******',
        'uid': '123123',
        'bbox': Polygon([
            (-71.0646843, 44.2371354), (-71.0048652, 44.2371354),
            (-71.0048652, 44.2430624), (-71.0646843, 44.2430624),
            (-71.0646843, 44.2371354)
        ])
    }
    ch = Analyse(ch_dict)
    ch.verify_editor()
    assert ch.powerfull_editor is False
Exemple #14
0
def test_analyse_verify_editor():
    ch_dict = {
        'created_by':
        'JOSM/1.5 (8339 en)',
        'created_at':
        '2015-04-25T18:08:46Z',
        'comment':
        'add pois',
        'id':
        '1',
        'user':
        '******',
        'bbox':
        Polygon([(-71.0646843, 44.2371354), (-71.0048652, 44.2371354),
                 (-71.0048652, 44.2430624), (-71.0646843, 44.2430624),
                 (-71.0646843, 44.2371354)])
    }
    ch = Analyse(ch_dict)
    ch.verify_editor()
    assert ch.powerfull_editor

    ch_dict = {
        'created_by':
        'Merkaartor 0.18 (de)',
        'created_at':
        '2015-04-25T18:08:46Z',
        'comment':
        'add pois',
        'id':
        '1',
        'user':
        '******',
        'bbox':
        Polygon([(-71.0646843, 44.2371354), (-71.0048652, 44.2371354),
                 (-71.0048652, 44.2430624), (-71.0646843, 44.2430624),
                 (-71.0646843, 44.2371354)])
    }
    ch = Analyse(ch_dict)
    ch.verify_editor()
    assert ch.powerfull_editor

    ch_dict = {
        'created_by':
        'Level0 v1.1',
        'created_at':
        '2015-04-25T18:08:46Z',
        'comment':
        'add pois',
        'id':
        '1',
        'user':
        '******',
        'bbox':
        Polygon([(-71.0646843, 44.2371354), (-71.0048652, 44.2371354),
                 (-71.0048652, 44.2430624), (-71.0646843, 44.2430624),
                 (-71.0646843, 44.2371354)])
    }
    ch = Analyse(ch_dict)
    ch.verify_editor()
    assert ch.powerfull_editor

    ch_dict = {
        'created_by':
        'QGIS plugin',
        'created_at':
        '2015-04-25T18:08:46Z',
        'comment':
        'add pois',
        'id':
        '1',
        'user':
        '******',
        'bbox':
        Polygon([(-71.0646843, 44.2371354), (-71.0048652, 44.2371354),
                 (-71.0048652, 44.2430624), (-71.0646843, 44.2430624),
                 (-71.0646843, 44.2371354)])
    }
    ch = Analyse(ch_dict)
    ch.verify_editor()
    assert ch.powerfull_editor

    ch_dict = {
        'created_by':
        'iD 1.7.3',
        'created_at':
        '2015-04-25T18:08:46Z',
        'comment':
        'add pois',
        'id':
        '1',
        'user':
        '******',
        'bbox':
        Polygon([(-71.0646843, 44.2371354), (-71.0048652, 44.2371354),
                 (-71.0048652, 44.2430624), (-71.0646843, 44.2430624),
                 (-71.0646843, 44.2371354)])
    }
    ch = Analyse(ch_dict)
    ch.verify_editor()
    assert ch.powerfull_editor is False

    ch_dict = {
        'created_by':
        'Potlatch 2',
        'created_at':
        '2015-04-25T18:08:46Z',
        'comment':
        'add pois',
        'id':
        '1',
        'user':
        '******',
        'bbox':
        Polygon([(-71.0646843, 44.2371354), (-71.0048652, 44.2371354),
                 (-71.0048652, 44.2430624), (-71.0646843, 44.2430624),
                 (-71.0646843, 44.2371354)])
    }
    ch = Analyse(ch_dict)
    ch.verify_editor()
    assert ch.powerfull_editor is False