def test_update_space(space_id, empty_space): """Test update space title and description.""" obj = XYZ(credentials=XYZ_TOKEN) space = obj.spaces.from_id(space_id=space_id) with pytest.raises(ValueError): space.update(title="", description="") title = "New Title" res1 = space.update(title=title) assert res1["title"] == title description = "New Description" res2 = space.update(description=description) assert res2["description"] == description # test tagging rules tagging_rules = { "large": "$.features[?(@.properties.area>=500)]", "small": "$.features[?(@.properties.area<500)]", } title = "New tagging Title" description = "New tagging Description" res = empty_space.update(title=title, description=description, tagging_rules=tagging_rules) assert res["title"] == title assert res["description"] == description empty_space.add_features(features=gj_chicago_parks) large_parks = empty_space.search(tags=["large"]) for park in large_parks: assert park["id"] in ["LP", "BP", "JP"] small_parks = empty_space.search(tags=["small"]) for park in small_parks: assert park["id"] in ["MP", "GP", "HP", "DP", "CP", "COP"]
def test_spaces_list(space_id): """Test get list of spaces.""" obj = XYZ() spaces_list = obj.spaces.list() assert len(spaces_list) > 0