Skip to content

Commit d21fe7c

Browse files
committed
2.6.2 release
1 parent 384aaa1 commit d21fe7c

File tree

9 files changed

+65
-25
lines changed

9 files changed

+65
-25
lines changed

office365/onedrive/listitems/collection.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ class ListItemCollection(EntityCollection[ListItem]):
88

99
def __init__(self, context, resource_path):
1010
super(ListItemCollection, self).__init__(context, ListItem, resource_path)
11-
self._honor_nonindexed = False
11+
self._honor_nonindexed = True
1212

1313
def honor_nonindexed(self, value):
1414
# type: (bool) -> "ListItemCollection"
@@ -32,3 +32,7 @@ def _construct_request(request):
3232
def get_by_name(self, name):
3333
"""Retrieve a list item by name"""
3434
return self.single("fields/FileLeafRef eq '{0}'".format(name))
35+
36+
def get_by_path(self, path):
37+
"""Retrieve a list item by path"""
38+
return self.single("fields/FileRef eq '{0}'".format(path))

office365/onedrive/sites/site.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class Site(BaseItem):
2626
"""The site resource provides metadata and relationships for a SharePoint site."""
2727

2828
def __str__(self):
29-
return self.name
29+
return self.name or self.entity_type_name
3030

3131
def __repr__(self):
3232
return self.name or self.web_url or self.id or self.entity_type_name

office365/sharepoint/fields/builtin_field_id.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,14 @@ class SPBuiltInFieldId:
1010
FSObjType = "FSObjType"
1111
"""Identifies a field that contains information about the file system type"""
1212

13+
FileDirRef = "FileDirRef"
14+
"""Identifies a field that contains information about the file directory for the specified
15+
SharePoint Foundation object."""
16+
17+
FileLeafRef = "FileLeafRef"
18+
"""Identifies a field that contains information about the server-relative URL for the file node that is
19+
associated with the specified SharePoint Foundation object."""
20+
1321
FileType = "FileType"
1422
"""Identifies a field that contains information about the file type for version history of the specified
1523
SharePoint Foundation library picture object."""

office365/sharepoint/userprofiles/people_manager.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,12 +148,13 @@ def stop_following_tag(self, value):
148148
return self
149149

150150
def get_user_profile_properties(self, user_or_name):
151+
# type: (str|User) -> ClientResult[dict]
151152
"""
152153
Gets the specified user profile properties for the specified user.
153154
154155
:param str or User user_or_name: User or Login name of the specified user.
155156
"""
156-
return_type = ClientResult(self.context, dict())
157+
return_type = ClientResult(self.context, {})
157158

158159
def _user_resolved(account_name):
159160
# type: (str) -> None

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
setup(
1111
name="Office365-REST-Python-Client",
12-
version="2.6.1",
12+
version="2.6.2",
1313
author="Vadim Gremyachev",
1414
author_email="[email protected]",
1515
maintainer="Konrad Gądek, Domenico Di Nicola",

tests/onedrive/test_list.py

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ class TestList(GraphTestCase):
99

1010
target_list = None # type: List
1111
target_column = None # type: ColumnDefinition
12+
list_name = create_unique_name("Documents")
1213

1314
@classmethod
1415
def setUpClass(cls):
@@ -18,25 +19,33 @@ def setUpClass(cls):
1819
def tearDownClass(cls):
1920
pass
2021

21-
def test1_get_list(self):
22-
target_list = self.client.sites.root.lists["Documents"].get().execute_query()
22+
def test1_create_list(self):
23+
result = self.client.sites.root.lists.add(
24+
self.list_name, "documentLibrary"
25+
).execute_query()
26+
self.__class__.target_list = result
27+
28+
def test2_get_list(self):
29+
target_list = self.client.sites.root.lists[self.list_name].get().execute_query()
2330
self.assertIsNotNone(target_list.resource_path)
24-
self.__class__.target_list = target_list
2531

26-
def test2_get_list_items(self):
32+
def test3_get_list_items(self):
2733
items = self.target_list.items.get().execute_query()
2834
self.assertIsNotNone(items.resource_path)
2935

30-
def test3_get_list_columns(self):
36+
def test4_get_list_columns(self):
3137
columns = self.target_list.columns.get().execute_query()
3238
self.assertIsNotNone(columns.resource_path)
3339

34-
def test4_create_list_column(self):
40+
def test5_create_list_column(self):
3541
column_name = create_unique_name("Text")
3642
text_column = self.target_list.columns.add_text(column_name).execute_query()
3743
self.assertIsNotNone(text_column.resource_path)
3844
self.__class__.target_column = text_column
3945

40-
def test5_delete_list_column(self):
46+
def test6_delete_list_column(self):
4147
column_to_del = self.__class__.target_column
4248
column_to_del.delete_object().execute_query()
49+
50+
def test7_delete_list(self):
51+
self.__class__.target_list.delete_object().execute_query()

tests/onedrive/test_listitem.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
from office365.onedrive.listitems.list_item import ListItem
2+
from office365.onedrive.lists.list import List
3+
from tests import test_team_site_url
4+
from tests.graph_case import GraphTestCase
5+
6+
7+
class TestListItem(GraphTestCase):
8+
""""""
9+
10+
target_list = None # type: List
11+
target_item = None # type: ListItem
12+
13+
@classmethod
14+
def setUpClass(cls):
15+
super(TestListItem, cls).setUpClass()
16+
cls.test_site = cls.client.sites.get_by_url(test_team_site_url)
17+
cls.pages_list = cls.test_site.lists.get_by_name("Site Pages")
18+
19+
@classmethod
20+
def tearDownClass(cls):
21+
pass
22+
23+
def test_1_get_item_by_name(self):
24+
result = self.pages_list.items.get_by_name("Home.aspx").execute_query()
25+
self.assertIsNotNone(result.resource_path)
26+
self.__class__.target_item = result
27+
28+
def test_3_get_item_values(self):
29+
item = self.__class__.target_item
30+
result = item.fields.get().execute_query()
31+
self.assertIsNotNone(result.resource_path)

tests/onedrive/test_sitepage.py

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,7 @@ def test2_get_site_page(self):
3131
def test3_checkin_site_page(self):
3232
page_name = self.__class__.target_page.name
3333
pages_list = self.test_site.lists.get_by_name("Site Pages")
34-
list_item = (
35-
pages_list.items.honor_nonindexed(True)
36-
.get_by_name(page_name)
37-
.execute_query()
38-
)
34+
list_item = pages_list.items.get_by_name(page_name).execute_query()
3935
list_item.drive_item.checkin("Initial version").execute_query()
4036
self.assertIsNotNone(list_item.resource_path)
4137

@@ -74,12 +70,3 @@ def test_10_delete_site_page(self):
7470
def test_11_get_site_page_list(self):
7571
result = self.test_site.lists.get_by_name("Site Pages").get().execute_query()
7672
self.assertIsNotNone(result.resource_path)
77-
78-
def test_12_get_site_page_item_by_name(self):
79-
pages_list = self.test_site.lists.get_by_name("Site Pages")
80-
result = (
81-
pages_list.items.honor_nonindexed(True)
82-
.get_by_name("Home.aspx")
83-
.execute_query()
84-
)
85-
self.assertIsNotNone(result.resource_path)
File renamed without changes.

0 commit comments

Comments
 (0)