Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_get_item_modified_datetime_modifiable(self):
fs = FileSystemInfo()
fs.last_modified_date_time = self.SAMPLE_ARROW_OBJ.datetime
self.item.file_system_info = fs
t, w = od_api_helper.get_item_modified_datetime(self.item)
self.assertTrue(w, 'fileSystemInfo.lastModifiedDateTime should be modifiable.')
self.assertEqual(self.SAMPLE_ARROW_OBJ, t)
def update_timestamp_and_record(self, new_item, item_local_stat):
remote_mtime, remote_mtime_w = get_item_modified_datetime(new_item)
if not remote_mtime_w:
# last_modified_datetime attribute is not modifiable in OneDrive server. Update local mtime.
fix_owner_and_timestamp(self.local_abspath, self.repo.context.user_uid,
datetime_to_timestamp(remote_mtime))
else:
file_system_info = FileSystemInfo()
file_system_info.last_modified_date_time = datetime.utcfromtimestamp(item_local_stat.st_mtime)
updated_item = Item()
updated_item.file_system_info = file_system_info
item_request = self.repo.authenticator.client.item(drive=self.repo.drive.id, id=new_item.id)
new_item = item_request_call(self.repo, item_request.update, updated_item)
self.repo.update_item(new_item, self.parent_relpath, item_local_stat.st_size)