コード例 #1
0
    def test_get_layers(self, server_iface, dbsession, test_data):
        ogcserver_accesscontrol = OGCServerAccessControl(
            server_iface,
            'qgisserver1',
            21781,
            dbsession
        )

        test_layers = test_data['layers']
        expected = {
            'public_group': [test_layers['public_group']],
            'public_layer': [test_layers['public_group'],
                             test_layers['public_layer']],
            'private_layer1': [test_layers['private_layer1']],
            'private_layer2': [test_layers['private_layer2']],
            'pg3': [test_layers['private_group3']],
            'pl3': [test_layers['private_group3'],
                    test_layers['private_layer3']],
        }

        layers = ogcserver_accesscontrol.get_layers()

        assert set(expected.keys()) == set(layers.keys())
        for key in expected.keys():
            assert set(expected[key]) == set(layers[key])
コード例 #2
0
    def test_get_layers(self, server_iface, DBSession):  # noqa: ignore=N803
        dbsession = DBSession()
        ogcserver_accesscontrol = OGCServerAccessControl(
            server_iface, "unavailable", "no_project", 21781,
            lambda: dbsession)

        assert ogcserver_accesscontrol.get_layers(dbsession) == {}
コード例 #3
0
    def test_get_layers(self, server_iface, DBSession, test_data):  # noqa: ignore=N803
        dbsession = DBSession()
        ogcserver_accesscontrol = OGCServerAccessControl(
            server_iface, "qgisserver1", "no_project", 21781, lambda: dbsession
        )

        expected = {
            "public_group": ["public_group"],
            "public_layer": ["public_group", "public_layer"],
            "private_layer1": ["private_layer1"],
            "private_layer2": ["private_layer2"],
            "pg3": ["private_group3"],
            "pl3": ["private_group3", "private_layer3"],
        }

        layers = ogcserver_accesscontrol.get_layers(dbsession)

        assert set(expected.keys()) == set(layers.keys())
        for key in expected.keys():
            assert set(expected[key]) == {layer.name for layer in layers[key]}
コード例 #4
0
    def test_get_layers(self, server_iface, dbsession, test_data):
        ogcserver_accesscontrol = OGCServerAccessControl(
            server_iface, "qgisserver1", 21781, dbsession)

        test_layers = test_data["layers"]
        expected = {
            "public_group": [test_layers["public_group"]],
            "public_layer":
            [test_layers["public_group"], test_layers["public_layer"]],
            "private_layer1": [test_layers["private_layer1"]],
            "private_layer2": [test_layers["private_layer2"]],
            "pg3": [test_layers["private_group3"]],
            "pl3":
            [test_layers["private_group3"], test_layers["private_layer3"]],
        }

        layers = ogcserver_accesscontrol.get_layers()

        assert set(expected.keys()) == set(layers.keys())
        for key in expected.keys():
            assert set(expected[key]) == set(layers[key])