From f5230e86eeba3eefac2226df8acccc4ed9563d75 Mon Sep 17 00:00:00 2001 From: vgrem Date: Wed, 8 Jan 2025 23:21:59 +0200 Subject: [PATCH] updates for workbooks namespace in OneDrive API --- examples/sharepoint/files/get_sharing_info.py | 27 ++++++++++++++ generator/import_metadata.py | 4 +-- .../privilegedaccess/approval.py | 8 +++++ .../privilegedaccess/group.py | 30 ++++++++++++++++ .../userconsent/request_collection.py | 10 ++++++ office365/onedrive/sitepages/webparts/data.py | 5 +++ .../onedrive/sitepages/webparts/standard.py | 9 +++++ office365/onedrive/workbooks/charts/chart.py | 36 ++++++++++++++++++- office365/onedrive/workbooks/charts/legend.py | 2 -- office365/onedrive/workbooks/charts/point.py | 5 +++ office365/onedrive/workbooks/charts/series.py | 5 --- .../workbooks/charts/series/__init__.py | 0 .../workbooks/charts/series/format.py | 5 +++ .../workbooks/charts/series/series.py | 31 ++++++++++++++++ office365/onedrive/workbooks/charts/title.py | 5 +++ office365/onedrive/workbooks/filter.py | 10 ++++++ .../onedrive/workbooks/filter_criteria.py | 6 ++-- office365/onedrive/workbooks/ranges/fill.py | 12 ++++++- office365/onedrive/workbooks/ranges/range.py | 9 +++++ office365/onedrive/workbooks/ranges/view.py | 14 ++++++++ office365/onedrive/workbooks/sort_field.py | 11 ++++-- office365/onedrive/workbooks/tables/sort.py | 20 +++++++++++ office365/sharepoint/forms/customization.py | 26 ++++++++++++++ office365/sharepoint/lists/list.py | 15 ++++++++ office365/sharepoint/principal/principal.py | 6 ++++ tests/onedrive/test_excel_ranges.py | 8 +++-- tests/onedrive/test_excel_tables.py | 34 ++++++++++++++++++ tests/outlook/test_event.py | 6 +++- tests/sharepoint/test_tenant.py | 4 +-- 29 files changed, 341 insertions(+), 22 deletions(-) create mode 100644 examples/sharepoint/files/get_sharing_info.py create mode 100644 office365/directory/identitygovernance/privilegedaccess/approval.py create mode 100644 office365/onedrive/sitepages/webparts/data.py create mode 100644 office365/onedrive/workbooks/charts/point.py delete mode 100644 office365/onedrive/workbooks/charts/series.py create mode 100644 office365/onedrive/workbooks/charts/series/__init__.py create mode 100644 office365/onedrive/workbooks/charts/series/format.py create mode 100644 office365/onedrive/workbooks/charts/series/series.py create mode 100644 office365/onedrive/workbooks/charts/title.py create mode 100644 tests/onedrive/test_excel_tables.py diff --git a/examples/sharepoint/files/get_sharing_info.py b/examples/sharepoint/files/get_sharing_info.py new file mode 100644 index 000000000..13524d471 --- /dev/null +++ b/examples/sharepoint/files/get_sharing_info.py @@ -0,0 +1,27 @@ +""" +Enumerates files along with role assignments +""" + +from office365.sharepoint.client_context import ClientContext +from office365.sharepoint.listitems.listitem import ListItem +from office365.sharepoint.principal.type import PrincipalType +from tests import test_client_credentials, test_team_site_url + +ctx = ClientContext(test_team_site_url).with_credentials(test_client_credentials) +doc_lib = ctx.web.default_document_library() +# retrieve all the files from a library +items = ( + doc_lib.items.select(["FSObjType", "EncodedAbsUrl", "Id"]) + .filter("FSObjType eq 0") + .get_all() + .execute_query() +) + +# per every list item (file facet) retrieve role assignments (where role assignment is associated with a principal, +# which could be a user or a group) +for item in items: # type: ListItem + role_assignments = item.role_assignments.expand(["Member"]).get().execute_query() + print("File: {0}".format(item.properties["EncodedAbsUrl"])) + for ra in role_assignments: + if ra.member.principal_type == PrincipalType.SharePointGroup: + print(ra.member) diff --git a/generator/import_metadata.py b/generator/import_metadata.py index 80922acb0..324762b51 100644 --- a/generator/import_metadata.py +++ b/generator/import_metadata.py @@ -26,13 +26,13 @@ def export_to_file(path, content): "--endpoint", dest="endpoint", help="Import metadata endpoint", - default="graph", + default="sharepoint", ) parser.add_argument( "-p", "--path", dest="path", - default="./metadata/Graph.xml", + default="./metadata/SharePoint.xml", help="Import metadata endpoint", ) diff --git a/office365/directory/identitygovernance/privilegedaccess/approval.py b/office365/directory/identitygovernance/privilegedaccess/approval.py new file mode 100644 index 000000000..6e4a82c82 --- /dev/null +++ b/office365/directory/identitygovernance/privilegedaccess/approval.py @@ -0,0 +1,8 @@ +from office365.entity import Entity + + +class Approval(Entity): + """Represents the approval object for decisions associated with a request. + + In PIM for groups, the approval object for decisions to approve or deny requests to activate + group membership or ownership.""" diff --git a/office365/directory/identitygovernance/privilegedaccess/group.py b/office365/directory/identitygovernance/privilegedaccess/group.py index 0397bf5d1..a4f6e26de 100644 --- a/office365/directory/identitygovernance/privilegedaccess/group.py +++ b/office365/directory/identitygovernance/privilegedaccess/group.py @@ -1,5 +1,35 @@ +from office365.directory.identitygovernance.privilegedaccess.approval import Approval +from office365.directory.identitygovernance.privilegedaccess.group_assignment_schedule_instance import ( + PrivilegedAccessGroupAssignmentScheduleInstance, +) from office365.entity import Entity +from office365.entity_collection import EntityCollection +from office365.runtime.paths.resource_path import ResourcePath class PrivilegedAccessGroup(Entity): """The entry point for all resources related to Privileged Identity Management (PIM) for groups.""" + + @property + def assignment_approvals(self): + """ """ + return self.properties.get( + "assignmentApprovals", + EntityCollection( + self.context, + Approval, + ResourcePath("assignmentApprovals", self.resource_path), + ), + ) + + @property + def assignment_schedule_instances(self): + """The instances of assignment schedules to activate a just-in-time access.""" + return self.properties.get( + "assignmentScheduleInstances", + EntityCollection( + self.context, + PrivilegedAccessGroupAssignmentScheduleInstance, + ResourcePath("assignmentScheduleInstances", self.resource_path), + ), + ) diff --git a/office365/directory/identitygovernance/userconsent/request_collection.py b/office365/directory/identitygovernance/userconsent/request_collection.py index 6a3005eac..433bff969 100644 --- a/office365/directory/identitygovernance/userconsent/request_collection.py +++ b/office365/directory/identitygovernance/userconsent/request_collection.py @@ -2,6 +2,7 @@ UserConsentRequest, ) from office365.entity_collection import EntityCollection +from office365.runtime.queries.function import FunctionQuery class UserConsentRequestCollection(EntityCollection[UserConsentRequest]): @@ -11,3 +12,12 @@ def __init__(self, context, resource_path=None): super(UserConsentRequestCollection, self).__init__( context, UserConsentRequest, resource_path ) + + def filter_by_current_user(self, on): + """Retrieve a collection of userConsentRequest objects for accessing a specified app, for which the current + user is the reviewer.""" + return_type = UserConsentRequestCollection(self.context, self.resource_path) + params = {"on": on} + qry = FunctionQuery(self, "filterByCurrentUser", params, return_type) + self.context.add_query(qry) + return return_type diff --git a/office365/onedrive/sitepages/webparts/data.py b/office365/onedrive/sitepages/webparts/data.py new file mode 100644 index 000000000..861b7db64 --- /dev/null +++ b/office365/onedrive/sitepages/webparts/data.py @@ -0,0 +1,5 @@ +from office365.runtime.client_value import ClientValue + + +class WebPartData(ClientValue): + """""" diff --git a/office365/onedrive/sitepages/webparts/standard.py b/office365/onedrive/sitepages/webparts/standard.py index 2203d294c..485e0c07d 100644 --- a/office365/onedrive/sitepages/webparts/standard.py +++ b/office365/onedrive/sitepages/webparts/standard.py @@ -1,5 +1,14 @@ +from typing import Optional + +from office365.onedrive.sitepages.webparts.data import WebPartData from office365.onedrive.sitepages.webparts.web_part import WebPart class StandardWebPart(WebPart): """Represents a standard web part instance on a SharePoint page.""" + + @property + def data(self): + # type: () -> Optional[WebPartData] + """Data of the webPart.""" + return self.properties.get("data", WebPartData()) diff --git a/office365/onedrive/workbooks/charts/chart.py b/office365/onedrive/workbooks/charts/chart.py index a4bc9119f..c417a74ed 100644 --- a/office365/onedrive/workbooks/charts/chart.py +++ b/office365/onedrive/workbooks/charts/chart.py @@ -1,6 +1,10 @@ from office365.entity import Entity +from office365.entity_collection import EntityCollection from office365.onedrive.workbooks.charts.axes import WorkbookChartAxes from office365.onedrive.workbooks.charts.data_labels import WorkbookChartDataLabels +from office365.onedrive.workbooks.charts.legend import WorkbookChartLegend +from office365.onedrive.workbooks.charts.series.series import WorkbookChartSeries +from office365.onedrive.workbooks.charts.title import WorkbookChartTitle from office365.runtime.client_result import ClientResult from office365.runtime.paths.resource_path import ResourcePath from office365.runtime.queries.function import FunctionQuery @@ -55,7 +59,7 @@ def axes(self): @property def data_labels(self): - """Represents the datalabels on the chart.""" + """Represents the data labels on the chart.""" return self.properties.get( "dataLabels", WorkbookChartDataLabels( @@ -63,6 +67,36 @@ def data_labels(self): ), ) + @property + def legend(self): + """Represents the legend on the chart.""" + return self.properties.get( + "legend", + WorkbookChartLegend( + self.context, ResourcePath("legend", self.resource_path) + ), + ) + + @property + def series(self): + """Represents chart series.""" + return self.properties.get( + "series", + EntityCollection( + self.context, + WorkbookChartSeries, + ResourcePath("series", self.resource_path), + ), + ) + + @property + def title(self): + """Represents the title on the chart.""" + return self.properties.get( + "title", + WorkbookChartTitle(self.context, ResourcePath("title", self.resource_path)), + ) + @property def worksheet(self): """The worksheet containing the current chart.""" diff --git a/office365/onedrive/workbooks/charts/legend.py b/office365/onedrive/workbooks/charts/legend.py index 8c0263b6d..4b6e19e4a 100644 --- a/office365/onedrive/workbooks/charts/legend.py +++ b/office365/onedrive/workbooks/charts/legend.py @@ -3,5 +3,3 @@ class WorkbookChartLegend(Entity): """Represents the legend in a chart.""" - - pass diff --git a/office365/onedrive/workbooks/charts/point.py b/office365/onedrive/workbooks/charts/point.py new file mode 100644 index 000000000..1857b6c04 --- /dev/null +++ b/office365/onedrive/workbooks/charts/point.py @@ -0,0 +1,5 @@ +from office365.entity import Entity + + +class WorkbookChartPoint(Entity): + """Represents a point of a series in a chart.""" diff --git a/office365/onedrive/workbooks/charts/series.py b/office365/onedrive/workbooks/charts/series.py deleted file mode 100644 index e3c33602e..000000000 --- a/office365/onedrive/workbooks/charts/series.py +++ /dev/null @@ -1,5 +0,0 @@ -from office365.entity import Entity - - -class WorkbookChartSeries(Entity): - pass diff --git a/office365/onedrive/workbooks/charts/series/__init__.py b/office365/onedrive/workbooks/charts/series/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/office365/onedrive/workbooks/charts/series/format.py b/office365/onedrive/workbooks/charts/series/format.py new file mode 100644 index 000000000..9d20c8ac6 --- /dev/null +++ b/office365/onedrive/workbooks/charts/series/format.py @@ -0,0 +1,5 @@ +from office365.entity import Entity + + +class WorkbookChartSeriesFormat(Entity): + """Encapsulates the format properties for the chart series""" diff --git a/office365/onedrive/workbooks/charts/series/series.py b/office365/onedrive/workbooks/charts/series/series.py new file mode 100644 index 000000000..85b02dd6a --- /dev/null +++ b/office365/onedrive/workbooks/charts/series/series.py @@ -0,0 +1,31 @@ +from office365.entity import Entity +from office365.entity_collection import EntityCollection +from office365.onedrive.workbooks.charts.point import WorkbookChartPoint +from office365.onedrive.workbooks.charts.series.format import WorkbookChartSeriesFormat +from office365.runtime.paths.resource_path import ResourcePath + + +class WorkbookChartSeries(Entity): + """Represents a series in a chart.""" + + @property + def format(self): + """The formatting of a chart series, which includes fill and line formatting.""" + return self.properties.get( + "format", + WorkbookChartSeriesFormat( + self.context, ResourcePath("format", self.resource_path) + ), + ) + + @property + def points(self): + """A collection of all points in the series.""" + return self.properties.get( + "points", + EntityCollection( + self.context, + WorkbookChartPoint, + ResourcePath("points", self.resource_path), + ), + ) diff --git a/office365/onedrive/workbooks/charts/title.py b/office365/onedrive/workbooks/charts/title.py new file mode 100644 index 000000000..b839dfdf3 --- /dev/null +++ b/office365/onedrive/workbooks/charts/title.py @@ -0,0 +1,5 @@ +from office365.entity import Entity + + +class WorkbookChartTitle(Entity): + """Represents a chart title object of a chart.""" diff --git a/office365/onedrive/workbooks/filter.py b/office365/onedrive/workbooks/filter.py index c6fd11b72..00fbab744 100644 --- a/office365/onedrive/workbooks/filter.py +++ b/office365/onedrive/workbooks/filter.py @@ -8,6 +8,16 @@ class WorkbookFilter(Entity): """Manages the filtering of a table's column.""" + def apply_bottom_items_filter(self, count=None): + """Perform a sort operation. + + :param str count: The number of items to apply the filter to. + """ + payload = {"count": count} + qry = ServiceOperationQuery(self, "applyBottomItemsFilter", None, payload) + self.context.add_query(qry) + return self + def clear(self): """Clear the filter on the given column.""" qry = ServiceOperationQuery(self, "clear") diff --git a/office365/onedrive/workbooks/filter_criteria.py b/office365/onedrive/workbooks/filter_criteria.py index 7be06f2d4..e75a7a19a 100644 --- a/office365/onedrive/workbooks/filter_criteria.py +++ b/office365/onedrive/workbooks/filter_criteria.py @@ -4,14 +4,14 @@ class WorkbookFilterCriteria(ClientValue): """Represents the filtering criteria applied to a column.""" - def __init__(self, color=None, dynamicCriteria=None, operator=None, values=None): + def __init__(self, color=None, dynamic_criteria=None, operator=None, values=None): """ :param str color: The color applied to the cell. - :param str dynamicCriteria: A dynamic formula specified in a custom filter. + :param str dynamic_criteria: A dynamic formula specified in a custom filter. :param str operator: An operator in a cell; for example, =, >, <, <=, or <>. :param list values: The values that appear in the cell. """ self.color = color - self.dynamicCriteria = dynamicCriteria + self.dynamicCriteria = dynamic_criteria self.operator = operator self.values = values diff --git a/office365/onedrive/workbooks/ranges/fill.py b/office365/onedrive/workbooks/ranges/fill.py index fa7bc89ed..7664af886 100644 --- a/office365/onedrive/workbooks/ranges/fill.py +++ b/office365/onedrive/workbooks/ranges/fill.py @@ -1,5 +1,15 @@ +from typing import Optional + from office365.entity import Entity class WorkbookRangeFill(Entity): - """Represents the background of a range object.""" + """HTML color code representing the color of the border line. Can either be of the form #RRGGBB, + for example "FFA500", or be a named HTML color, for example "orange".""" + + @property + def color(self): + # type: () -> Optional[str] + """Gets or sets the width of all columns within the range. If the column widths aren't uniform, + null will be returned.""" + return self.properties.get("color", None) diff --git a/office365/onedrive/workbooks/ranges/range.py b/office365/onedrive/workbooks/ranges/range.py index 706cc7031..1f9afeaa5 100644 --- a/office365/onedrive/workbooks/ranges/range.py +++ b/office365/onedrive/workbooks/ranges/range.py @@ -54,6 +54,15 @@ def insert(self, shift): self.context.add_query(qry) return return_type + def last_row(self): + """ + Get the last row within the range. For example, the last row of B2:D5 is B5:D5. + """ + return_type = WorkbookRange(self.context) + qry = FunctionQuery(self, "lastRow", return_type=return_type) + self.context.add_query(qry) + return return_type + def visible_view(self): """Get the range visible from a filtered range.""" return_type = WorkbookRangeView(self.context) diff --git a/office365/onedrive/workbooks/ranges/view.py b/office365/onedrive/workbooks/ranges/view.py index 1b0af3653..91721ff3f 100644 --- a/office365/onedrive/workbooks/ranges/view.py +++ b/office365/onedrive/workbooks/ranges/view.py @@ -1,3 +1,5 @@ +from typing import Optional + from office365.entity import Entity from office365.entity_collection import EntityCollection from office365.runtime.paths.resource_path import ResourcePath @@ -6,6 +8,18 @@ class WorkbookRangeView(Entity): """Represents a set of visible cells of the parent range.""" + @property + def cell_addresses(self): + # type: () -> Optional[dict] + """The cell addresses.""" + return self.properties.get("cellAddresses", None) + + @property + def column_count(self): + # type: () -> Optional[int] + """The number of visible columns.""" + return self.properties.get("columnCount", None) + @property def rows(self): # type: () -> EntityCollection[WorkbookRangeView] diff --git a/office365/onedrive/workbooks/sort_field.py b/office365/onedrive/workbooks/sort_field.py index 53125251b..258a6e316 100644 --- a/office365/onedrive/workbooks/sort_field.py +++ b/office365/onedrive/workbooks/sort_field.py @@ -6,13 +6,18 @@ class WorkbookSortField(ClientValue): """Represents a condition in a sorting operation.""" def __init__( - self, ascending=None, color=None, dataOption=None, icon=WorkbookIcon(), key=None + self, + ascending=None, + color=None, + data_option=None, + icon=WorkbookIcon(), + key=None, ): """ :param bool ascending: Represents whether the sorting is done in an ascending fashion. :param str color: Represents the color that is the target of the condition if the sorting is on font or cell color. - :param str dataOption: Represents additional sorting options for this field. + :param str data_option: Represents additional sorting options for this field. Possible values are: Normal, TextAsNumber. :param WorkbookIcon icon: Represents the icon that is the target of the condition if the sorting is on the cell's icon. @@ -21,6 +26,6 @@ def __init__( """ self.ascending = ascending self.color = color - self.dataOption = dataOption + self.dataOption = data_option self.icon = icon self.key = key diff --git a/office365/onedrive/workbooks/tables/sort.py b/office365/onedrive/workbooks/tables/sort.py index e00cfca1f..8874bef81 100644 --- a/office365/onedrive/workbooks/tables/sort.py +++ b/office365/onedrive/workbooks/tables/sort.py @@ -1,5 +1,25 @@ from office365.entity import Entity +from office365.onedrive.workbooks.sort_field import WorkbookSortField +from office365.runtime.client_value_collection import ClientValueCollection +from office365.runtime.queries.service_operation import ServiceOperationQuery class WorkbookTableSort(Entity): """Manages sorting operations on Table objects.""" + + def apply(self, fields, match_case=None, method=None): + """Perform a sort operation. + + :param list[WorkbookSortField] fields: The list of conditions to sort on. + :param bool match_case: Indicates whether to match the case of the items being sorted. + :param str method: The ordering method used for Chinese characters. + The possible values are: PinYin, StrokeCount. + """ + payload = { + "fields": ClientValueCollection(WorkbookSortField, fields), + "matchCase": match_case, + "method": method, + } + qry = ServiceOperationQuery(self, "apply", None, payload) + self.context.add_query(qry) + return self diff --git a/office365/sharepoint/forms/customization.py b/office365/sharepoint/forms/customization.py index ccc98b8d7..b97c738af 100644 --- a/office365/sharepoint/forms/customization.py +++ b/office365/sharepoint/forms/customization.py @@ -1,7 +1,33 @@ +from typing import TYPE_CHECKING, Optional + +from office365.runtime.queries.service_operation import ServiceOperationQuery from office365.sharepoint.entity import Entity +from office365.sharepoint.flows.connector_result import ConnectorResult + +if TYPE_CHECKING: + from office365.sharepoint.client_context import ClientContext class FormsCustomization(Entity): + + @staticmethod + def can_customize_forms(context, list_name, return_type=None): + # type: (ClientContext, str, Optional[ConnectorResult]) -> ConnectorResult + """""" + if return_type is None: + return_type = ConnectorResult(context) + payload = {"listName": list_name} + qry = ServiceOperationQuery( + FormsCustomization(context), + "CanCustomizeForms", + None, + payload, + None, + return_type, + ) + context.add_query(qry) + return return_type + @property def entity_type_name(self): return "SP.Internal.FormsCustomization" diff --git a/office365/sharepoint/lists/list.py b/office365/sharepoint/lists/list.py index 5fefde2a8..c2bf4b7b3 100644 --- a/office365/sharepoint/lists/list.py +++ b/office365/sharepoint/lists/list.py @@ -89,6 +89,21 @@ def export(self, local_file, include_content=False, item_exported=None): return ListExporter.export(self, local_file, include_content, item_exported) + def can_customize_forms(self): + """""" + from office365.sharepoint.flows.connector_result import ConnectorResult + from office365.sharepoint.forms.customization import FormsCustomization + + return_type = ConnectorResult(self.context) + + def _can_customize_forms(): + FormsCustomization.can_customize_forms( + self.context, self.title, return_type + ) + + self.ensure_property("Title", _can_customize_forms) + return return_type + def clear(self): """Clears the list.""" diff --git a/office365/sharepoint/principal/principal.py b/office365/sharepoint/principal/principal.py index 538909272..abdcde458 100644 --- a/office365/sharepoint/principal/principal.py +++ b/office365/sharepoint/principal/principal.py @@ -1,7 +1,9 @@ from typing import Optional +from office365.runtime.odata.type import ODataType from office365.runtime.paths.service_operation import ServiceOperationPath from office365.sharepoint.entity import Entity +from office365.sharepoint.principal.type import PrincipalType class Principal(Entity): @@ -60,6 +62,10 @@ def principal_type(self): """Gets the type of the principal.""" return self.properties.get("PrincipalType", None) + @property + def principal_type_name(self): + return ODataType.resolve_enum_key(PrincipalType, self.principal_type) + @property def property_ref_name(self): return "Id" diff --git a/tests/onedrive/test_excel_ranges.py b/tests/onedrive/test_excel_ranges.py index 1674484a7..b8b907e8c 100644 --- a/tests/onedrive/test_excel_ranges.py +++ b/tests/onedrive/test_excel_ranges.py @@ -38,14 +38,18 @@ def test3_list_range(self): self.assertIsNotNone(result.address) self.__class__.range = result + def test4_last_row(self): + result = self.__class__.range.last_row().execute_query() + self.assertIsNotNone(result.address) + # def test4_insert_range(self): # result = self.__class__.range.insert("Right").execute_query() # self.assertIsNotNone(result.address) - def test5_used_range(self): + def test6_used_range(self): result = self.__class__.range.used_range().execute_query() self.assertIsNotNone(result.address) - def test6_clear_range(self): + def test7_clear_range(self): result = self.__class__.range.clear().execute_query() self.assertIsNotNone(result.address) diff --git a/tests/onedrive/test_excel_tables.py b/tests/onedrive/test_excel_tables.py new file mode 100644 index 000000000..0cdc54522 --- /dev/null +++ b/tests/onedrive/test_excel_tables.py @@ -0,0 +1,34 @@ +from examples.sharepoint.lists.assessment.broken_tax_field_value import fields +from office365.onedrive.driveitems.driveItem import DriveItem +from office365.onedrive.workbooks.sort_field import WorkbookSortField +from office365.onedrive.workbooks.tables.table import WorkbookTable +from office365.onedrive.workbooks.worksheets.worksheet import WorkbookWorksheet +from tests.graph_case import GraphTestCase + + +class TestExcelTables(GraphTestCase): + excel_file = None # type: DriveItem + worksheet = None # type: WorkbookWorksheet + table = None # type: WorkbookTable + + @classmethod + def setUpClass(cls): + super(TestExcelTables, cls).setUpClass() + path = "../data/Financial Sample.xlsx" + cls.excel_file = cls.client.me.drive.root.upload_file(path).execute_query() + assert cls.excel_file.resource_path is not None + cls.worksheet = ( + cls.excel_file.workbook.worksheets["Sheet1"].get().execute_query() + ) + assert cls.worksheet.resource_path is not None + cls.table = cls.worksheet.tables["financials"].get().execute_query() + assert cls.table.resource_path is not None + + @classmethod + def tearDownClass(cls): + cls.excel_file.delete_object().execute_query_retry() + + def test1_sort_apply(self): + sort_fields = [WorkbookSortField()] + result = self.__class__.table.sort.apply(sort_fields).execute_query() + self.assertIsNotNone(result.resource_path) diff --git a/tests/outlook/test_event.py b/tests/outlook/test_event.py index 7f545f886..1e075a5da 100644 --- a/tests/outlook/test_event.py +++ b/tests/outlook/test_event.py @@ -29,7 +29,11 @@ def test4_update_event(self): event.subject = "Let's go for lunch (updated)" event.update().execute_query() - def test5_delete_event(self): + # def test5_cancel_event(self): + # event = self.__class__.target_event + # event.cancel().execute_query() + + def test6_delete_event(self): event_to_delete = self.__class__.target_event event_to_delete.delete_object().execute_query() # verify diff --git a/tests/sharepoint/test_tenant.py b/tests/sharepoint/test_tenant.py index 4de4f722f..816c5c216 100644 --- a/tests/sharepoint/test_tenant.py +++ b/tests/sharepoint/test_tenant.py @@ -195,8 +195,8 @@ def test_27_get_spo_all_web_templates(self): result = self.tenant.get_spo_all_web_templates().execute_query() self.assertIsNotNone(result) - #SharePoint Advanced Management license is needed to perform this action - #def test_28_get_collaboration_insights_data(self): + # SharePoint Advanced Management license is needed to perform this action + # def test_28_get_collaboration_insights_data(self): # # Note: You need a SharePoint Advanced Management license to perform this action # result = self.tenant.get_collaboration_insights_data().execute_query() # self.assertIsNotNone(result.value)