예제 #1
0
def test_layer_details(qtbot, qgis_application, mock_geonode_server, id_):
    app = ResponseCollector()
    client = apiv2.GeonodeApiV2Client(base_url="http://localhost:9000")
    client.layer_detail_received.connect(app.collect_response)
    with qtbot.waitSignal(client.layer_detail_received,
                          timeout=SIGNAL_TIMEOUT * 1000):
        client.get_layer_detail(id_=id_)
    layer: models.GeonodeResource = app.received_response[0]
    assert id_ == layer.pk
예제 #2
0
def test_layer_styles(qtbot, qgis_application, mock_geonode_server, id_):
    app = ResponseCollector()
    client = apiv2.GeonodeApiV2Client(base_url="http://localhost:9000")
    client.layer_styles_received.connect(app.collect_response)
    with qtbot.waitSignal(client.layer_styles_received,
                          timeout=SIGNAL_TIMEOUT * 1000):
        client.get_layer_styles(layer_id=id_)
    print(f"received_response: {app.received_response}")
    styles = app.received_response[0]
    assert len(styles) == 1
예제 #3
0
def test_map_list(qtbot, qgis_application, mock_geonode_server, page):
    app = ResponseCollector()
    client = apiv2.GeonodeApiV2Client(base_url="http://localhost:9000")
    client.map_list_received.connect(app.collect_response)
    with qtbot.waitSignal(client.map_list_received,
                          timeout=SIGNAL_TIMEOUT * 1000):
        client.get_maps(GeonodeApiSearchFilters(page=page))
    maps, pagination_info = app.received_response
    pagination_info: models.GeonodePaginationInfo
    assert pagination_info.page_size == 2
    assert maps[0].pk == 43
예제 #4
0
def test_layer_list_filtering(qtbot, qgis_application, mock_geonode_server,
                              page):
    app = ResponseCollector()
    client = apiv2.GeonodeApiV2Client(base_url="http://localhost:9000")
    client.layer_list_received.connect(app.collect_response)
    with qtbot.waitSignal(client.layer_list_received,
                          timeout=SIGNAL_TIMEOUT * 1000):
        client.get_layers(
            GeonodeApiSearchFilters(page=page,
                                    title="TEMPERATURASMINENERO2030"))
    layers, pagination_info = app.received_response
    print(f"layer ids: {[la.pk for la in layers]}")
    assert len(layers) == 1
    assert layers[0].name == "TEMPERATURASMINENERO2030"
예제 #5
0
def test_layer_list(qtbot, qgis_application, mock_geonode_server, page):
    app = ResponseCollector()
    client = apiv2.GeonodeApiV2Client(base_url="http://localhost:9000")
    client.layer_list_received.connect(app.collect_response)
    with qtbot.waitSignal(client.layer_list_received,
                          timeout=SIGNAL_TIMEOUT * 1000):
        client.get_layers(GeonodeApiSearchFilters(page=page))
    layers, pagination_info = app.received_response
    pagination_info: models.GeonodePaginationInfo

    print(f"layer ids: {[la.pk for la in layers]}")

    layers_size = len(layers)

    assert layers_size == 2
    assert pagination_info.current_page == 1
    assert pagination_info.page_size == 2