Skip to content

Commit bdaf895

Browse files
committed
#866 fixes
1 parent 6334eb3 commit bdaf895

File tree

3 files changed

+7
-8
lines changed

3 files changed

+7
-8
lines changed

examples/onedrive/files/upload.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,13 @@
1313
)
1414

1515
client = GraphClient.with_client_secret(test_tenant, test_client_id, test_client_secret)
16-
folder = client.users.get_by_principal_name(test_user_principal_name_alt).drive.root
16+
user_drive = client.users.get_by_principal_name(test_user_principal_name_alt).drive
17+
folder = user_drive.root
1718

1819
local_path = "../../data/Financial Sample.xlsx"
1920
# local_path = "../../data/countries.json"
2021
# file = folder.upload_file(local_path).execute_query()
2122
with open(local_path, "rb") as f:
2223
file = folder.upload_file(f).execute_query()
2324
print("File {0} has been uploaded".format(file.web_url))
25+
result = folder.children.get().execute_query()

office365/onedrive/driveitems/driveItem.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -911,7 +911,7 @@ def subscriptions(self):
911911
def set_property(self, name, value, persist_changes=True):
912912
super(DriveItem, self).set_property(name, value, persist_changes)
913913
if name == "parentReference":
914-
self._resource_path.parent.patch(self.parent_reference.driveId)
914+
pass
915915
return self
916916

917917
def get_property(self, name, default_value=None):

tests/onedrive/test_file.py

+3-6
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,9 @@ def test2_get_folder_permissions(self):
4242

4343
def test3_upload_file(self):
4444
file_name = "SharePoint User Guide.docx"
45-
path = "{0}/../data/{1}".format(os.path.dirname(__file__), file_name)
46-
with open(path, "rb") as content_file:
47-
file_content = content_file.read()
48-
file_name = os.path.basename(path)
49-
self.__class__.target_file = self.target_drive.root.upload(
50-
file_name, file_content
45+
file_path = "{0}/../data/{1}".format(os.path.dirname(__file__), file_name)
46+
self.__class__.target_file = self.target_drive.root.upload_file(
47+
file_path
5148
).execute_query()
5249
self.assertIsNotNone(self.target_file.web_url)
5350

0 commit comments

Comments
 (0)