diff --git a/tests/providers/box/test_provider.py b/tests/providers/box/test_provider.py index b2f750215..b9870f352 100644 --- a/tests/providers/box/test_provider.py +++ b/tests/providers/box/test_provider.py @@ -165,7 +165,9 @@ async def test_validate_path(self, provider, root_provider_fixtures): provider.folder = '0' folder_id = '0' - good_url = provider.build_url('folders', folder_id, 'items', fields='id,name,type', limit=1000) + good_url = provider.build_url('folders', folder_id, 'items', + fields='id,name,type', limit=1000) + aiohttpretty.register_json_uri('GET', good_url, body=root_provider_fixtures['revalidate_metadata'], status=200) @@ -295,7 +297,7 @@ async def test_upload_checksum_mismatch(self, provider, root_provider_fixtures, aiohttpretty.register_json_uri('POST', upload_url, status=201, body=root_provider_fixtures['checksum_mismatch_metadata']) - with pytest.raises(exceptions.UploadChecksumMismatchError) as exc: + with pytest.raises(exceptions.UploadChecksumMismatchError): await provider.upload(file_stream, path) assert aiohttpretty.has_call(method='POST', uri=upload_url) @@ -360,8 +362,11 @@ async def test_delete_root(self, provider, root_provider_fixtures): url = provider.build_url('folders', root_path.identifier, 'items', fields='id,name,size,modified_at,etag,total_count', offset=(0), limit=1000) - aiohttpretty.register_json_uri('GET', url, - body=root_provider_fixtures['one_entry_folder_list_metadata']) + aiohttpretty.register_json_uri( + 'GET', + url, + body=root_provider_fixtures['one_entry_folder_list_metadata'] + ) url = provider.build_url('files', item['id'], fields='id,name,path_collection') delete_url = provider.build_url('files', path.identifier) @@ -621,7 +626,9 @@ async def test_intra_copy_folder(self, provider, intra_fixtures, root_provider_f expected_folder = BoxFolderMetadata(item, dest_path) expected_folder._children = [] for child_item in list_metadata['entries']: - child_path = dest_path.child(child_item['name'], folder=(child_item['type'] == 'folder')) + child_path = dest_path.child(child_item['name'], + folder=(child_item['type'] == 'folder')) + serialized_child = provider._serialize_item(child_item, child_path) expected_folder._children.append(serialized_child) expected = (expected_folder, True) @@ -632,7 +639,10 @@ async def test_intra_copy_folder(self, provider, intra_fixtures, root_provider_f @pytest.mark.asyncio @pytest.mark.aiohttpretty - async def test_intra_copy_folder_replace(self, provider, intra_fixtures, root_provider_fixtures): + async def test_intra_copy_folder_replace(self, + provider, + intra_fixtures, + root_provider_fixtures): item = intra_fixtures['intra_folder_metadata'] list_metadata = root_provider_fixtures['folder_list_metadata'] @@ -652,7 +662,9 @@ async def test_intra_copy_folder_replace(self, provider, intra_fixtures, root_pr expected_folder = BoxFolderMetadata(item, dest_path) expected_folder._children = [] for child_item in list_metadata['entries']: - child_path = dest_path.child(child_item['name'], folder=(child_item['type'] == 'folder')) + child_path = dest_path.child(child_item['name'], + folder=(child_item['type'] == 'folder')) + serialized_child = provider._serialize_item(child_item, child_path) expected_folder._children.append(serialized_child) expected = (expected_folder, False) @@ -685,7 +697,8 @@ async def test_intra_move_file(self, provider, root_provider_fixtures): async def test_intra_move_file_replace(self, provider, root_provider_fixtures): item = root_provider_fixtures['file_metadata']['entries'][0] src_path = WaterButlerPath('/name.txt', _ids=(provider, item['id'])) - dest_path = WaterButlerPath('/charmander/name.txt', _ids=(provider, item['id'], 'YgzZejrj834j')) + dest_path = WaterButlerPath('/charmander/name.txt', + _ids=(provider, item['id'], 'YgzZejrj834j')) file_url = provider.build_url('files', src_path.identifier) delete_url = provider.build_url('files', dest_path.identifier) @@ -717,7 +730,10 @@ async def test_intra_move_folder(self, provider, intra_fixtures, root_provider_f expected_folder = BoxFolderMetadata(item, dest_path) expected_folder._children = [] for child_item in list_metadata['entries']: - child_path = dest_path.child(child_item['name'], folder=(child_item['type'] == 'folder')) + child_path = dest_path.child( + child_item['name'], + folder=(child_item['type'] == 'folder') + ) serialized_child = provider._serialize_item(child_item, child_path) expected_folder._children.append(serialized_child) expected = (expected_folder, True) @@ -728,7 +744,10 @@ async def test_intra_move_folder(self, provider, intra_fixtures, root_provider_f @pytest.mark.asyncio @pytest.mark.aiohttpretty - async def test_intra_move_folder_replace(self, provider, intra_fixtures, root_provider_fixtures): + async def test_intra_move_folder_replace(self, + provider, + intra_fixtures, + root_provider_fixtures): item = intra_fixtures['intra_folder_metadata'] list_metadata = root_provider_fixtures['folder_list_metadata'] @@ -748,7 +767,9 @@ async def test_intra_move_folder_replace(self, provider, intra_fixtures, root_pr expected_folder = BoxFolderMetadata(item, dest_path) expected_folder._children = [] for child_item in list_metadata['entries']: - child_path = dest_path.child(child_item['name'], folder=(child_item['type'] == 'folder')) + child_path = dest_path.child(child_item['name'], + folder=(child_item['type'] == 'folder')) + serialized_child = provider._serialize_item(child_item, child_path) expected_folder._children.append(serialized_child) expected = (expected_folder, False) @@ -831,8 +852,8 @@ async def test_returns_metadata(self, provider, root_provider_fixtures): class TestOperations: - def test_will_self_overwrite(self, provider, other_provider): + def test_will_self_overwrite(self, provider, other_provider): src_path = WaterButlerPath('/50 shades of nope.txt', _ids=(provider.folder, '12231')) dest_path = WaterButlerPath('/50 shades of nope2223.txt', _ids=(provider.folder, '2342sdfsd')) diff --git a/tests/providers/dropbox/test_provider.py b/tests/providers/dropbox/test_provider.py index 19a4c186e..649853eda 100644 --- a/tests/providers/dropbox/test_provider.py +++ b/tests/providers/dropbox/test_provider.py @@ -290,8 +290,12 @@ async def test_folder_with_subdirectory_metadata(self, provider, root_provider_f path = await provider.validate_path('/') url = provider.build_url('files', 'list_folder') data = {'path': path.full_path} - aiohttpretty.register_json_uri('POST', url, data=data, - body=root_provider_fixtures['folder_with_subdirectory_metadata']) + aiohttpretty.register_json_uri( + 'POST', + url, + data=data, + body=root_provider_fixtures['folder_with_subdirectory_metadata'] + ) result = await provider.metadata(path) assert isinstance(result, list) @@ -308,8 +312,12 @@ async def test_folder_with_hasmore_metadata(self, provider, root_provider_fixtur data = {'path': path.full_path} aiohttpretty.register_json_uri('POST', url, data=data, body=root_provider_fixtures['folder_with_hasmore_metadata']) - aiohttpretty.register_json_uri('POST', url + '/continue', data=data, - body=root_provider_fixtures['folder_with_subdirectory_metadata']) + aiohttpretty.register_json_uri( + 'POST', + url + '/continue', + data=data, + body=root_provider_fixtures['folder_with_subdirectory_metadata'] + ) result = await provider.metadata(path) @@ -544,7 +552,9 @@ async def test_intra_copy_replace_file(self, provider, root_provider_fixtures, e { 'headers': {'Content-Type': 'application/json'}, 'data': data, - 'body': json.dumps(error_fixtures['rename_conflict_folder_metadata']).encode('utf-8'), + 'body': json.dumps( + error_fixtures['rename_conflict_folder_metadata'] + ).encode('utf-8'), 'status': 409 }, { @@ -574,8 +584,12 @@ async def test_intra_copy_file_different_provider(self, provider, other_provider url1 = provider.build_url('files', 'copy_reference', 'save') data1 = {'copy_reference': 'test', 'path': dest_path.full_path.rstrip('/')} - aiohttpretty.register_json_uri('POST', url1, data=data1, - body=intra_copy_fixtures['intra_copy_other_provider_file_metadata']) + aiohttpretty.register_json_uri( + 'POST', + url1, + data=data1, + body=intra_copy_fixtures['intra_copy_other_provider_file_metadata'] + ) result = await provider.intra_copy(other_provider, src_path, dest_path) expected = (DropboxFileMetadata( @@ -648,7 +662,9 @@ async def test_intra_move_replace_file(self, provider, root_provider_fixtures, e { 'headers': {'Content-Type': 'application/json'}, 'data': data, - 'body': json.dumps(error_fixtures['rename_conflict_file_metadata']).encode('utf-8'), + 'body': json.dumps( + error_fixtures['rename_conflict_file_metadata'] + ).encode('utf-8'), 'status': 409 }, { @@ -689,7 +705,9 @@ async def test_intra_move_replace_folder(self, provider, root_provider_fixtures, { 'headers': {'Content-Type': 'application/json'}, 'data': data, - 'body': json.dumps(error_fixtures['rename_conflict_folder_metadata']).encode('utf-8'), + 'body': json.dumps( + error_fixtures['rename_conflict_folder_metadata'] + ).encode('utf-8'), 'status': 409 }, { @@ -723,9 +741,10 @@ async def test_intra_move_casing_change(self, provider): class TestOperations: def test_will_self_overwrite(self, provider, other_provider): - - src_path = WaterButlerPath('/50 shades of nope.txt', _ids=(provider.folder, '12231')) - dest_path = WaterButlerPath('/50 shades of nope2223.txt', _ids=(provider.folder, '2342sdfsd')) + src_path = WaterButlerPath('/50 shades of nope.txt', + _ids=(provider.folder, '12231')) + dest_path = WaterButlerPath('/50 shades of nope2223.txt', + _ids=(provider.folder, '2342sdfsd')) result = provider.will_self_overwrite(other_provider, src_path, dest_path) assert result is False @@ -743,7 +762,7 @@ def test_can_intra_move(self, provider): assert provider.can_intra_move(provider) def test_cannot_intra_move_other(self, provider, other_provider): - assert provider.can_intra_move(other_provider) == False + assert provider.can_intra_move(other_provider) is False def test_conflict_error_handler_not_found(self, provider, error_fixtures): error_path = '/Photos/folder/file' diff --git a/tests/providers/googledrive/test_provider.py b/tests/providers/googledrive/test_provider.py index 039b7d44f..eeee379c1 100644 --- a/tests/providers/googledrive/test_provider.py +++ b/tests/providers/googledrive/test_provider.py @@ -1577,7 +1577,6 @@ async def test_intra_copy_file(self, provider, root_provider_fixtures): class TestOperationsOrMisc: def test_will_self_overwrite(self, provider, other_provider): - src_path = GoogleDrivePath('/root/Gear1.stl', _ids=['0', '10', '11']) dest_path = GoogleDrivePath('/root/Gear23123.stl', _ids=['0', '10', '12']) diff --git a/tests/providers/owncloud/test_provider.py b/tests/providers/owncloud/test_provider.py index 23e3ec420..e9f3ffce4 100644 --- a/tests/providers/owncloud/test_provider.py +++ b/tests/providers/owncloud/test_provider.py @@ -362,9 +362,10 @@ async def test_revisions(self, provider, file_metadata): class TestOperations: def test_will_self_overwrite(self, provider): - - src_path = WaterButlerPath('/50 shades of nope.txt', _ids=(provider.folder, '12231')) - dest_path = WaterButlerPath('/50 shades of nope2223.txt', _ids=(provider.folder, '2342sdfsd')) + src_path = WaterButlerPath('/50 shades of nope.txt', + _ids=(provider.folder, '12231')) + dest_path = WaterButlerPath('/50 shades of nope2223.txt', + _ids=(provider.folder, '2342sdfsd')) result = provider.will_self_overwrite(provider, src_path, dest_path) assert result is False