Exemple #1
0
    def test_list_with_pagination(self):
        some_folders = folders.list_folders(limit=2)
        assert isinstance(some_folders, list)
        assert len(some_folders) <= 2
        assert all(isinstance(f, RestObj) for f in some_folders)

        other_folders = folders.list_folders(start=2, limit=3)
        assert isinstance(other_folders, list)
        assert len(other_folders) <= 3
        assert all(f not in some_folders for f in other_folders)
    def test_list_with_pagination(self):
        some_folders = folders.list_folders(limit=2)

        # PagedList with technically include all results, so subset to just
        # the results that were explicitly requested
        some_folders = some_folders[:2]

        assert isinstance(some_folders, list)
        assert all(isinstance(f, RestObj) for f in some_folders)

        other_folders = folders.list_folders(start=2, limit=3)
        assert isinstance(other_folders, list)
        other_folders = other_folders[:3]

        assert all(f not in some_folders for f in other_folders)
Exemple #3
0
def test_list_folders():
    from sasctl.services.folders import list_folders

    folders = list_folders()
    assert all(isinstance(f, RestObj) for f in folders)
Exemple #4
0
 def test_list_folders(self):
     all_folders = folders.list_folders()
     assert all(isinstance(f, RestObj) for f in all_folders)
from sasctl import Session
from sasctl.services import folders, reports

with Session("http://va85.gel.sas.com", "sbxxab", "SASlnx33"):
    # Retrieve folder path
    filter = "contains(name, 'Rep')"
    for folder in folders.list_folders(filter=filter):
        folder_path = {folder["id"]: folder["name"]}
        current = folder
        while id not in folder_path.keys():
            if "parentFolderUri" in current.keys():
                id = current["parentFolderUri"].split("/")[-1]
                current = folders.get_folder(id)
                folder_path[current["id"]] = current["name"]
            else:
                id = current["id"].split("/")[-1]
        path_components = list(folder_path.values())
        path_components.reverse()
        path = "/" + "/".join(path_components)
        # print(path)

    # Retrieve report path
    filter = "contains(name, 'CarsReport')"
    for report in reports.list_reports(filter=filter):
        folder = folder.get_folder(childUri=report["id"])
        print(folder)