def folder_with_files(monkeypatch, mocked_folder): monkeypatch.setattr(BoxFile, 'set_box_item', MagicMock()) monkeypatch.setattr(BoxFile, 'enable_shared_link', MagicMock()) f1 = BoxFile(None, None) f2 = BoxFile(None, None) f1.shared_link = 'link' f2.shared_link = 'link' monkeypatch.setattr(BoxFolder, 'items', [f1, f2]) bf = mocked_folder return bf
def nested_file(monkeypatch): monkeypatch.setattr(BoxFolder, 'set_box_item', MagicMock()) monkeypatch.setattr(BoxFile, 'set_box_item', MagicMock()) fold1 = BoxFolder() fold1.name = 'fold1' fold2 = BoxFolder(parent=fold1) fold2.name = 'fold2' file1 = BoxFile(parent=fold2) file1.name = 'file1' fold1._items = [fold2] fold2._items = [file1] return file1
def nested_folder_with_access_stats(monkeypatch): monkeypatch.setattr(BoxFolder, 'set_box_item', MagicMock()) monkeypatch.setattr(BoxFile, 'set_box_item', MagicMock()) monkeypatch.setattr(BoxItem, 'has_shared_link', True) fold1 = BoxFolder() fold1._download_count = 1 fold1._preview_count = 2 setattr(fold1, 'name', 'fold1') fold2 = BoxFolder(parent=fold1) fold2._download_count = 2 fold2._preview_count = 3 setattr(fold2, 'name', 'fold2') file1 = BoxFile(parent=fold2) file1._download_count = 5 file1._preview_count = 6 file1._name = 'file1' setattr(file1, 'name', 'file1') fold1._items = [fold2] fold2._items = [file1] return fold1
def mocked_file(monkeypatch): monkeypatch.setattr(BoxFile, 'set_box_item', MagicMock()) bf = BoxFile(None, None) bf._box_item = MagicMock() return bf