Beispiel #1
0
 def test_client_time(self):
     self.data['fileSystemInfo'] = get_data('facets/filesysteminfo_facet.json')
     self.assertNotEqual(self.data['fileSystemInfo']['createdDateTime'], self.data['createdDateTime'])
     self.assertNotEqual(self.data['fileSystemInfo']['lastModifiedDateTime'], self.data['lastModifiedDateTime'])
     item = items.OneDriveItem(get_sample_drive_object(), self.data)
     self.assert_timestamps(self.data['fileSystemInfo'], item)
     self.assert_timestamps(self.data['fileSystemInfo'], item.fs_info)
Beispiel #2
0
 def test_load_errors(self):
     drive = drive_factory.get_sample_drive_object()
     drive_root = drive.root
     dump = drive.dump()
     new_drive = drives.DriveObject.load(drive_root, account_id='123', account_type=drive_root.account.TYPE, s=dump)
     self.assertIsInstance(new_drive, drives.DriveObject)
     self.assertEqual(0, len(drive_root._cached_drives))
Beispiel #3
0
 def test_client_time(self):
     self.data['fileSystemInfo'] = get_data('facets/filesysteminfo_facet.json')
     self.assertNotEqual(self.data['fileSystemInfo']['createdDateTime'], self.data['createdDateTime'])
     self.assertNotEqual(self.data['fileSystemInfo']['lastModifiedDateTime'], self.data['lastModifiedDateTime'])
     item = items.OneDriveItem(get_sample_drive_object(), self.data)
     self.assert_timestamps(self.data['fileSystemInfo'], item)
     self.assert_timestamps(self.data['fileSystemInfo'], item.fs_info)
Beispiel #4
0
 def get_cached_drive_root_tuple(self):
     drive = drive_factory.get_sample_drive_object()
     drive_root = drive.root
     account = drive_root.account
     drive_root.add_cached_drive(account.profile.user_id, account.TYPE,
                                 drive)
     return drive_root, drive
Beispiel #5
0
 def setUp(self):
     self.all_items = []
     self.all_items_data = []
     self.drive = drive_factory.get_sample_drive_object()
     self.itemdb_mgr = db_factory.get_sample_item_storage_manager()
     self.itemdb = self.itemdb_mgr.get_item_storage(self.drive)
     for name in ['image_item.json', 'folder_item.json', 'folder_child_item.json']:
         self._add_item(name)
Beispiel #6
0
 def setUp(self):
     self.pool = get_sample_task_pool()
     self.worker = TaskConsumer(self.pool)
     self.task = TaskBase(None)
     self.task.drive = get_sample_drive_object()
     self.task.rel_parent_path = '/'
     self.task.item_name = 'foo'
     self.mock_handler = mock.Mock(return_value=None)
     self.task.handle = self.mock_handler
Beispiel #7
0
 def setUp(self):
     self.data = get_data('image_item.json')
     self.data['audio'] = get_data('facets/audio_facet.json')
     self.data['deleted'] = get_data('facets/deleted_facet.json')
     self.data['photo'] = get_data('facets/photo_facet.json')
     self.data['video'] = get_data('facets/video_facet.json')
     self.data['specialFolder'] = get_data('facets/specialfolder_facet.json')
     self.data['location'] = get_data('facets/location_facet.json')
     self.data['parentReference'] = get_data('item_reference.json')
     self.item = items.OneDriveItem(drive=get_sample_drive_object(), data=self.data)
Beispiel #8
0
 def setUp(self):
     self.data = get_data('image_item.json')
     self.data['audio'] = get_data('facets/audio_facet.json')
     self.data['deleted'] = get_data('facets/deleted_facet.json')
     self.data['photo'] = get_data('facets/photo_facet.json')
     self.data['video'] = get_data('facets/video_facet.json')
     self.data['specialFolder'] = get_data('facets/specialfolder_facet.json')
     self.data['location'] = get_data('facets/location_facet.json')
     self.data['parentReference'] = get_data('item_reference.json')
     self.item = items.OneDriveItem(drive=get_sample_drive_object(), data=self.data)
Beispiel #9
0
 def setUp(self):
     self.all_items = []
     self.all_items_data = []
     self.drive = drive_factory.get_sample_drive_object()
     self.itemdb_mgr = db_factory.get_sample_item_storage_manager()
     self.itemdb = self.itemdb_mgr.get_item_storage(self.drive)
     for name in [
             'image_item.json', 'folder_item.json', 'folder_child_item.json'
     ]:
         self._add_item(name)
 def setUp(self):
     self.drive = drive_factory.get_sample_drive_object()
     self.data = get_data('async_operation_response.json')
     self.session = resources.AsyncCopySession(self.drive,
                                               {'Location': 'https://foo'})
Beispiel #11
0
 def setUp(self):
     self.data = get_data('drive_root.json')
     self.item = items.OneDriveItem(drive=get_sample_drive_object(), data=self.data)
Beispiel #12
0
 def test_time_fallback(self):
     item = items.OneDriveItem(get_sample_drive_object(), self.data)
     self.assert_timestamps(self.data, item)
Beispiel #13
0
 def test_time_fallback(self):
     item = items.OneDriveItem(get_sample_drive_object(), self.data)
     self.assert_timestamps(self.data, item)
Beispiel #14
0
 def test_delete_record(self):
     drive = get_sample_drive_object()
     self.drives_store.add_record(drive)
     self.assertEqual(1, len(self.drives_store.get_all_drives()))
     self.drives_store.delete_record(drive)
     self.assertEqual(0, len(self.drives_store.get_all_drives()))
Beispiel #15
0
 def setUp(self):
     self.drive = drive_factory.get_sample_drive_object()
     self.data = get_data('async_operation_response.json')
     self.session = resources.AsyncCopySession(self.drive, {'Location': 'https://foo'})
Beispiel #16
0
 def setUp(self):
     self.data = get_data('drive.json')
     self.drive = drive_factory.get_sample_drive_object(self.data)
Beispiel #17
0
 def setUp(self):
     self.data = get_data('drive_root.json')
     self.item = items.OneDriveItem(drive=get_sample_drive_object(), data=self.data)
Beispiel #18
0
 def test_delete_record(self):
     drive = get_sample_drive_object()
     self.drives_store.add_record(drive)
     self.assertEqual(1, len(self.drives_store.get_all_drives()))
     self.drives_store.delete_record(drive)
     self.assertEqual(0, len(self.drives_store.get_all_drives()))
Beispiel #19
0
 def get_cached_drive_root_tuple(self):
     drive = drive_factory.get_sample_drive_object()
     drive_root = drive.root
     account = drive_root.account
     drive_root.add_cached_drive(account.profile.user_id, account.TYPE, drive)
     return drive_root, drive