def test_list_variables(valid_adapter): lib = Items(default_adapter=valid_adapter) lib.load_work_item("workspace-id", "workitem-id-second") names = lib.list_work_item_variables() assert len(names) == 2 assert "username" in names assert "address" in names
def test_delete_variables_multiple(valid_adapter): lib = Items(default_adapter=valid_adapter) lib.load_work_item("workspace-id", "workitem-id-second") assert "username" in lib.list_work_item_variables() assert len(lib.current["variables"]) == 2 lib.delete_work_item_variables("username") assert "username" not in lib.list_work_item_variables() assert len(lib.current["variables"]) == 1
def test_delete_variables_unknown(valid_adapter): lib = Items(default_adapter=valid_adapter) lib.load_work_item("workspace-id", "workitem-id-second") assert len(lib.list_work_item_variables()) == 2 lib.delete_work_item_variables("unknown-variable") assert len(lib.list_work_item_variables()) == 2 with pytest.raises(KeyError): lib.delete_work_item_variables("unknown-variable", force=False) assert len(lib.list_work_item_variables()) == 2
def test_delete_variables(valid_adapter): lib = Items(default_adapter=valid_adapter) lib.load_work_item("workspace-id", "workitem-id-second") assert "username" in lib.list_work_item_variables() lib.delete_work_item_variables("username") assert "username" not in lib.list_work_item_variables() lib.delete_work_item_variables("doesntexist") with pytest.raises(KeyError): lib.delete_work_item_variables("doesntexist", force=False)
def test_delete_variables_multiple(valid_adapter): lib = Items(default_adapter=valid_adapter) lib.load_work_item("workspace-id", "workitem-id-second") names = lib.list_work_item_variables() assert "username" in names assert "address" in names assert len(names) == 2 lib.delete_work_item_variables("username", "address") names = lib.list_work_item_variables() assert "username" not in names assert "username" not in names assert len(names) == 0
def test_keyword_save_item(valid_adapter): lib = Items(default_adapter=valid_adapter) item = lib.load_work_item("test-ws", "second-item") MockAdapter.validate(item, "username", "another") item.data["username"] = "******" lib.save_work_item() MockAdapter.validate(item, "username", "changed")
def test_keyword_save_work_item(valid_adapter): lib = Items(default_adapter=valid_adapter) item = lib.load_work_item("workspace-id", "workitem-id-second") MockAdapter.validate(item, "variables", VARIABLES_SECOND) modified = {"username": "******", "address": "*****@*****.**"} item.data["variables"] = modified lib.save_work_item() MockAdapter.validate(item, "variables", modified)
def test_keyword_load_item(valid_adapter): lib = Items(default_adapter=valid_adapter) item = lib.load_work_item("test-ws", "second-item") assert item.data["username"] == "another" assert item == lib.current
def test_keyword_load_work_item(valid_adapter): lib = Items(default_adapter=valid_adapter) item = lib.load_work_item("workspace-id", "workitem-id-second") assert item.data["variables"] == VARIABLES_SECOND assert item == lib.current