def METHOD_NAME(self):
    col_id = self.col.id
    url = "/api/2/collections/%s/mappings" % col_id
    res = self.client.get(url, headers=self.headers)
    assert res.status_code == 200, res
    validate(res.json, "QueryResponse")
    res = self.client.get(url, headers=self.headers_x)
    assert res.status_code == 403, res
    url = "/api/2/collections/%s/mappings?filter:table=%s" % (col_id, self.ent.id)
    res = self.client.get(url, headers=self.headers)
    assert res.status_code == 200, res
    validate(res.json, "QueryResponse")
    data = {
        "table_id": self.ent.id,
        "mapping_query": {
            "person": {
                "schema": "Person",
                "keys": ["name", "nationality"],
                "properties": {
                    "name": {"column": "name"},
                    "nationality": {"column": "nationality"},
                },
            }
        },
    }
    res = self.client.post(url, json=data, headers=self.headers_x)
    assert res.status_code == 403, res
    res = self.client.post(url, json=data, headers=self.headers)
    assert res.status_code == 200, res
    validate(res.json, "Mapping")
    mapping_id = res.json.get("id")
    index_url = (
        "/api/2/entities?filter:collection_id=%s&filter:schemata=LegalEntity"
    )
    index_url = index_url % col_id
    res = self.client.get(index_url, headers=self.headers)
    assert res.status_code == 200, res
    assert res.json["total"] == 1, res.json
    url = "/api/2/collections/%s/mappings/%s/trigger" % (
        col_id,
        mapping_id,
    )
    res = self.client.post(url, headers=self.headers_x)
    assert res.status_code == 403, res
    res = self.client.post(url, headers=self.headers)
    assert res.status_code == 202, res
    url = "/api/2/collections/%s/mappings/%s" % (col_id, mapping_id)
    res = self.client.get(url, headers=self.headers)
    assert res.status_code == 200, res
    validate(res.json, "Mapping")
    assert res.json["last_run_status"] == "successful", res.json
    assert "last_run_err_msg" not in res.json, res.json
    origin = "mapping%%3A%s" % mapping_id
    url = (
        "/api/2/entities?filter:collection_id=%s&filter:schema=Person&filter:origin=%s"  # noqa: E501
        % (col_id, origin)
    )
    res = self.client.get(url, headers=self.headers)
    assert res.status_code == 200, res.json
    assert res.json["total"] == 14, res.json
    person = res.json["results"][0]["properties"]
    assert person.get("proof")[0].get("id") == self.ent.id, person
    # test deleting loaded entities
    url = "/api/2/collections/%s/mappings/%s/flush" % (
        col_id,
        mapping_id,
    )
    res = self.client.post(url, headers=self.headers_x)
    assert res.status_code == 403, res
    res = self.client.post(url, headers=self.headers)
    assert res.status_code == 202, res
    res = self.client.get(index_url, headers=self.headers)
    assert res.status_code == 200, res
    # The pre-existing legal entity should not be deleted
    assert res.json["total"] == 1, res.json
    data = {
        "table_id": self.ent2.id,
        "mapping_query": {
            "person": {
                "schema": "Person",
                "keys": ["name", "nationality"],
                "properties": {
                    "name": {"column": "name"},
                    "nationality": {"column": "nationality"},
                    "gender": {"column": "gender"},
                },
            }
        },
    }
    url = "/api/2/collections/%s/mappings/%s" % (col_id, mapping_id)
    res = self.client.get(url, headers=self.headers)
    assert res.status_code == 200, res
    assert "gender" not in json.dumps(res.json["query"]), res.json
    url = "/api/2/collections/%s/mappings/%s" % (col_id, mapping_id)
    res = self.client.post(url, json=data, headers=self.headers_x)
    assert res.status_code == 403, res
    res = self.client.post(url, json=data, headers=self.headers)
    assert res.status_code == 200, res
    assert res.json.get("table_id") == self.ent2.id, res.json
    assert "gender" in json.dumps(res.json["query"])
    res = self.client.get(index_url, headers=self.headers)
    assert res.status_code == 200, res
    assert res.json["total"] == 1, res.json
    url = "/api/2/collections/%s/mappings/%s/trigger" % (
        col_id,
        mapping_id,
    )
    res = self.client.post(url, headers=self.headers)
    res = self.client.get(index_url, headers=self.headers)
    assert res.json["total"] == 15, res.json
    url = "/api/2/collections/%s/mappings/%s" % (col_id, mapping_id)
    res = self.client.delete(url, headers=self.headers_x)
    assert res.status_code == 403, res
    res = self.client.delete(url, headers=self.headers)
    assert res.status_code == 204, res
    res = self.client.get(url, headers=self.headers)
    assert res.status_code == 404, res
    res = self.client.get(index_url, headers=self.headers)
    assert res.status_code == 200, res
    assert res.json["total"] == 1, res.json