Skip to content

Commit

Permalink
Merge branch 'feature/onedrive' into develop
Browse files Browse the repository at this point in the history
 This feature was done as a COS-funded Integration Grant by:
  * Ryan Casey (@caseyrygt)

 Additional work was done on read-write support by Alexandr Melnikov
 (@alexandr-melnikov-dev-pro).  Read-write will be added in a future
 release.

 Thank you both for all your hard work on this!

 [SVCS-269] [SVCS-458]
 Closes: #205
 Related: #102, #151, #177
  • Loading branch information
felliott committed Nov 13, 2017
2 parents 14eca9a + b1f1233 commit 26bf209
Show file tree
Hide file tree
Showing 19 changed files with 2,510 additions and 0 deletions.
8 changes: 8 additions & 0 deletions docs/provider.onedrive.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
OneDrive Provider
=================

.. autoclass:: waterbutler.providers.onedrive.provider.OneDriveProvider
:members:
:undoc-members:
:show-inheritance:
:inherited-members:
1 change: 1 addition & 0 deletions docs/providers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Providers
provider.github
provider.gitlab
provider.googledrive
provider.onedrive
provider.osfstorage
provider.owncloud
provider.cloudfiles
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ def parse_requirements(requirements):
'dataverse = waterbutler.providers.dataverse:DataverseProvider',
'box = waterbutler.providers.box:BoxProvider',
'googledrive = waterbutler.providers.googledrive:GoogleDriveProvider',
'onedrive = waterbutler.providers.onedrive:OneDriveProvider',
],
'waterbutler.providers.tasks': [
'osfstorage_parity = waterbutler.providers.osfstorage.tasks.parity',
Expand Down
Empty file.
35 changes: 35 additions & 0 deletions tests/providers/onedrive/fixtures.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import os
import json
import pytest


@pytest.fixture
def root_provider_fixtures():
# fixtures for testing validate_v1_path for root provider
with open(os.path.join(os.path.dirname(__file__), 'fixtures/root_provider.json'), 'r') as fp:
return json.load(fp)


@pytest.fixture
def subfolder_provider_fixtures():
# fixtures for testing validate_v1_path for subfolder provider
with open(os.path.join(os.path.dirname(__file__), 'fixtures/subfolder_provider.json'), 'r') as fp:
return json.load(fp)


@pytest.fixture
def revision_fixtures():
with open(os.path.join(os.path.dirname(__file__), 'fixtures/revisions.json'), 'r') as fp:
return json.load(fp)


@pytest.fixture
def download_fixtures():
with open(os.path.join(os.path.dirname(__file__), 'fixtures/download.json'), 'r') as fp:
return json.load(fp)


@pytest.fixture
def path_fixtures():
with open(os.path.join(os.path.dirname(__file__), 'fixtures/paths.json'), 'r') as fp:
return json.load(fp)
227 changes: 227 additions & 0 deletions tests/providers/onedrive/fixtures/download.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,227 @@
{
"root_id": "F4D50E400DFE7D4E!103",
"file_id": "F4D50E400DFE7D4E!291",
"file_revision": "aRjRENTBFNDAwREZFN0Q0RSEyOTEuMg",
"onenote_id": "F4D50E400DFE7D4E!154",
"onenote_revision": "aRjRENTBFNDAwREZFN0Q0RSExNTQuMg",
"file_download_url" : "https://public.bn1303.livefilestore.com/y4mB8JhDUWbofzVglNap3rO5i6R7jOQyJAz995dPlkrOiQeOV2jgK-EOf916z8YHi9A42WCTMVfNmHjJliYLccUFzJgsEK3j3cviT2YLlZBMRVN-sC0mfvZz_ZeDgiLzfSChMmNXkRoq6Ymh_F8r8jRAvZTzJOgyX3F7jdw4qcY27tz95Rutrl68W0Z8ntuh3bVoPIDHC5kckF8sSWoyv5j4BfRQCckjyrmaV8F1BM5Cb1x10WNdE7CP_X1bBFqY7ZTJzYcsQcDR07BdalvRTDp-A",
"file_revision_download_url": "https://kdqyaa.bn1303.livefilestore.com/y4pIg3zgkmcBaQ_b2CpkxiYLihuF-GaqI-zBWermrthafHBogxMCjK6Q2qA_DoELVL0-oogK2WBYfx_CKyjynFBkRe61e6OsMDAfn0NEo4fSLSXamfrMRZ0-Pyf8ZgUujCNHpaihbkj2hwIlvnNJez0ZDerAEdfA7jos7JQnVfEAU2GNXGnsyx9Yrn9VC72xLmeMdDh676UTL9gpG-2xj4BX1AI2Ro7phbbB1n2kwnwNRZOaK1tusL8cyUfjs7joD4X",
"file_content": "ten of them",
"file_revisions": {
"value" : [
{
"@content.downloadUrl" : "https://kdqyaa.bn1303.livefilestore.com/y4pIg3zgkmcBaQ_b2CpkxiYLihuF-GaqI-zBWermrthafHBogxMCjK6Q2qA_DoELVL0-oogK2WBYfx_CKyjynFBkRe61e6OsMDAfn0NEo4fSLSXamfrMRZ0-Pyf8ZgUujCNHpaihbkj2hwIlvnNJez0ZDerAEdfA7jos7JQnVfEAU2GNXGnsyx9Yrn9VC72xLmeMdDh676UTL9gpG-2xj4BX1AI2Ro7phbbB1n2kwnwNRZOaK1tusL8cyUfjs7joD4X",
"createdDateTime" : "2017-08-17T17:49:39.613Z",
"fileSystemInfo" : {
"lastModifiedDateTime" : "2017-08-17T17:49:50.363Z",
"createdDateTime" : "2017-08-17T17:49:39.613Z"
},
"name" : "toes.txt",
"size" : 11,
"eTag" : "aRjRENTBFNDAwREZFN0Q0RSEyOTEuMg",
"cTag" : "aYzpGNEQ1MEU0MDBERkU3RDRFITI5MS4yNTg",
"createdBy" : {
"user" : {
"displayName" : "Fitz Elliott",
"id" : "f4d50e400dfe7d4e"
},
"application" : {
"id" : "481710a4"
}
},
"lastModifiedDateTime" : "2017-08-17T17:49:50.38Z",
"file" : {
"mimeType" : "text/plain",
"hashes" : {
"sha1Hash" : "D6FAC576DCF80198874C9C9476F021AF3F12688C"
}
},
"webUrl" : "https://1drv.ms/t/s!AE59_g1ADtX0giM",
"id" : "F4D50E400DFE7D4E!291",
"parentReference" : {
"id" : "F4D50E400DFE7D4E!103",
"name" : "root:",
"path" : "/drive/root:",
"driveId" : "f4d50e400dfe7d4e"
},
"lastModifiedBy" : {
"user" : {
"id" : "f4d50e400dfe7d4e",
"displayName" : "Fitz Elliott"
},
"application" : {
"id" : "481710a4"
}
}
}
],
"@odata.context" : "https://api.onedrive.com/v1.0/$metadata#drives('me')/items",
"@odata.deltaLink" : "https://api.onedrive.com/v1.0/drives('me')/items('F4D50E400DFE7D4E!291')/view.delta?$top=250&token=aTE09NjM2Mzg1OTM3MTAzMzc7SUQ9RjRENTBFNDAwREZFN0Q0RSEyOTE7TFI9NjM2Mzg5MTk0MDUyMTA7RVA9MTY7U0k9ODA7U0c9MTtTTz0yO1BJPTM",
"@delta.token" : "aTE09NjM2Mzg1OTM3MTAzMzc7SUQ9RjRENTBFNDAwREZFN0Q0RSEyOTE7TFI9NjM2Mzg5MTk0MDUyMTA7RVA9MTY7U0k9ODA7U0c9MTtTTz0yO1BJPTM"
},
"file_metadata" : {
"createdDateTime" : "2017-08-17T17:49:39.613Z",
"eTag" : "aRjRENTBFNDAwREZFN0Q0RSEyOTEuMg",
"id" : "F4D50E400DFE7D4E!291",
"children" : [],
"lastModifiedBy" : {
"application" : {
"displayName" : "OneDrive",
"id" : "481710a4"
},
"user" : {
"id" : "f4d50e400dfe7d4e",
"displayName" : "Fitz Elliott"
}
},
"fileSystemInfo" : {
"lastModifiedDateTime" : "2017-08-17T17:49:50.363Z",
"createdDateTime" : "2017-08-17T17:49:39.613Z"
},
"name" : "toes.txt",
"parentReference" : {
"driveId" : "f4d50e400dfe7d4e",
"path" : "/drive/root:",
"id" : "F4D50E400DFE7D4E!103"
},
"@odata.context" : "https://api.onedrive.com/v1.0/$metadata#drives('me')/items/$entity",
"lastModifiedDateTime" : "2017-08-17T17:49:50.38Z",
"file" : {
"hashes" : {
"sha1Hash" : "D6FAC576DCF80198874C9C9476F021AF3F12688C"
},
"mimeType" : "text/plain"
},
"@content.downloadUrl" : "https://public.bn1303.livefilestore.com/y4mB8JhDUWbofzVglNap3rO5i6R7jOQyJAz995dPlkrOiQeOV2jgK-EOf916z8YHi9A42WCTMVfNmHjJliYLccUFzJgsEK3j3cviT2YLlZBMRVN-sC0mfvZz_ZeDgiLzfSChMmNXkRoq6Ymh_F8r8jRAvZTzJOgyX3F7jdw4qcY27tz95Rutrl68W0Z8ntuh3bVoPIDHC5kckF8sSWoyv5j4BfRQCckjyrmaV8F1BM5Cb1x10WNdE7CP_X1bBFqY7ZTJzYcsQcDR07BdalvRTDp-A",
"cTag" : "aYzpGNEQ1MEU0MDBERkU3RDRFITI5MS4yNTg",
"createdBy" : {
"application" : {
"id" : "481710a4",
"displayName" : "OneDrive"
},
"user" : {
"displayName" : "Fitz Elliott",
"id" : "f4d50e400dfe7d4e"
}
},
"webUrl" : "https://1drv.ms/t/s!AE59_g1ADtX0giM",
"children@odata.context" : "https://api.onedrive.com/v1.0/$metadata#drives('me')/items('F4D50E400DFE7D4E%21291')/children",
"size" : 11
},
"onenote_metadata": {"createdDateTime": "2017-02-23T07:27:44.253Z", "createdBy": {"application": {"id": "44048800", "displayName": "OneDrive website"}, "user": {"id": "f4d50e400dfe7d4e", "displayName": "Fitz Elliott"}}, "fileSystemInfo": {"createdDateTime": "2017-02-23T07:27:44.253Z", "lastModifiedDateTime": "2017-03-30T15:06:25.41Z"}, "children@odata.context": "https://api.onedrive.com/v1.0/$metadata#drives('me')/items('F4D50E400DFE7D4E%21154')/children", "children": [{"createdDateTime": "2017-02-23T07:28:14.373Z", "createdBy": {"user": {"id": "f4d50e400dfe7d4e", "displayName": "Fitz Elliott"}}, "fileSystemInfo": {"createdDateTime": "2017-02-23T07:28:14.373Z", "lastModifiedDateTime": "2017-02-23T07:28:30.647Z"}, "parentReference": {"name": "foo", "driveId": "f4d50e400dfe7d4e", "id": "F4D50E400DFE7D4E!154", "path": "/drive/root:/onenote/foo"}, "id": "F4D50E400DFE7D4E!157", "@content.downloadUrl": "https://iphwow.bn1303.livefilestore.com/y4mAB7VXKZCHWK5ib57BF1aaT_v4YLxoPS4xsR9Hw550zzwU56pPw_SC7OZbzDvHx5q5NTZ-BFQgfSuVgZ3vmURfkMOPRDmWC3vZiznhvfNNL46eBg9ZIFYNVpEolrUIvtsz_PjjlfUT0g_JA4qzGqCIMLPXLweE02hEVc9OfynPJiwx9vNNJpF1e021bkXv-kFEN3efR0uenDB-epaphmEQg", "name": "foo.one", "eTag": "aRjRENTBFNDAwREZFN0Q0RSExNTcuMjI", "size": 25474, "webUrl": "https://1drv.ms/o/s!AE59_g1ADtX0gR0", "file": {"mimeType": "application/msonenote"}, "lastModifiedBy": {"user": {"id": "f4d50e400dfe7d4e", "displayName": "Fitz Elliott"}}, "lastModifiedDateTime": "2017-02-23T07:28:30.663Z"}, {"createdDateTime": "2017-02-23T07:28:17.623Z", "createdBy": {"user": {"id": "f4d50e400dfe7d4e", "displayName": "Fitz Elliott"}}, "fileSystemInfo": {"createdDateTime": "2017-02-23T07:28:17.623Z", "lastModifiedDateTime": "2017-02-23T07:28:18.86Z"}, "parentReference": {"name": "foo", "driveId": "f4d50e400dfe7d4e", "id": "F4D50E400DFE7D4E!154", "path": "/drive/root:/onenote/foo"}, "id": "F4D50E400DFE7D4E!158", "@content.downloadUrl": "https://iphwow.bn1303.livefilestore.com/y4mpsZP831upa5BsCeniFzoWYj4vkU1Ul_M4VEi_QYvAeGoU-FiH9GiH9UzL9_cVYtPxgyLnyesMkeAFC9mjcbKNU8kMstHLbypJjKI5oiUGVjBoqUhKaVifBR1cTrKXkN4aQKmHjZce8O65IRgQHiT_HuPCSE4DmqnyPMwWCg36b1PLH2OsU1kww7HOLKxMb_eeBtNaJMUbZMk1CgJLVpDvA", "name": "Open Notebook.onetoc2", "eTag": "aRjRENTBFNDAwREZFN0Q0RSExNTguNA", "size": 2885, "webUrl": "https://1drv.ms/o/s!AE59_g1ADtX0gR4", "file": {"mimeType": "application/msonenote"}, "lastModifiedBy": {"user": {"id": "f4d50e400dfe7d4e", "displayName": "Fitz Elliott"}}, "lastModifiedDateTime": "2017-02-23T07:28:18.873Z"}], "eTag": "aRjRENTBFNDAwREZFN0Q0RSExNTQuMg", "parentReference": {"name": "onenote", "driveId": "f4d50e400dfe7d4e", "id": "F4D50E400DFE7D4E!289", "path": "/drive/root:/onenote"}, "id": "F4D50E400DFE7D4E!154", "name": "foo", "package": {"type": "oneNote"}, "@odata.context": "https://api.onedrive.com/v1.0/$metadata#drives('me')/items/$entity", "size": 28359, "webUrl": "https://1drv.ms/o/s!AE59_g1ADtX0gRo", "cTag": "adDpGNEQ1MEU0MDBERkU3RDRFITE1NC42MzYyNjQ4MzE4NTQxMDAwMDA", "lastModifiedBy": {"user": {"id": "f4d50e400dfe7d4e", "displayName": "Fitz Elliott"}}, "lastModifiedDateTime": "2017-03-30T15:06:25.41Z"},
"onenote_revisions": {
"@delta.token" : "aTE09NjM2MjY0ODMxODU0MTA7SUQ9RjRENTBFNDAwREZFN0Q0RSExNTQ7TFI9NjM2Mzg5MzczNzM0NjA7RVA9MTY7U0k9MjM7U0c9MTtTTz0yO1BJPTM",
"value" : [
{
"package" : {
"type" : "oneNote"
},
"parentReference" : {
"driveId" : "f4d50e400dfe7d4e",
"path" : "/drive/root:/onenote",
"id" : "F4D50E400DFE7D4E!289",
"name" : "onenote"
},
"webUrl" : "https://1drv.ms/o/s!AE59_g1ADtX0gRo",
"size" : 28359,
"id" : "F4D50E400DFE7D4E!154",
"fileSystemInfo" : {
"lastModifiedDateTime" : "2017-03-30T15:06:25.41Z",
"createdDateTime" : "2017-02-23T07:27:44.253Z"
},
"name" : "foo",
"eTag" : "aRjRENTBFNDAwREZFN0Q0RSExNTQuMg",
"lastModifiedBy" : {
"user" : {
"id" : "f4d50e400dfe7d4e",
"displayName" : "Fitz Elliott"
}
},
"lastModifiedDateTime" : "2017-03-30T15:06:25.41Z",
"cTag" : "adDpGNEQ1MEU0MDBERkU3RDRFITE1NC42MzYyNjQ4MzE4NTQxMDAwMDA",
"createdDateTime" : "2017-02-23T07:27:44.253Z",
"createdBy" : {
"application" : {
"id" : "44048800"
},
"user" : {
"id" : "f4d50e400dfe7d4e",
"displayName" : "Fitz Elliott"
}
}
},
{
"id" : "F4D50E400DFE7D4E!158",
"file" : {
"mimeType" : "application/msonenote"
},
"@content.downloadUrl" : "https://iphwow.bn1303.livefilestore.com/y4pB5XnZJaQpc7j3QF0J1Vp1WsJ9rxxM--_MPMmLGQYIXPQ_SmmGN02qVe8bhBWVX3W6E_2ALvntfbHW7xQEgmFAWapl9pFrFZaKfJmwSd93nXlpRazVF3M-qmx2wWZN44gQiAYcWyhtU8VIkl2AhOoo6BeVcX2CJuOkqAhZLeYQJZ2jUykEsCBBMfJsxCt12xQfKzAU6jF0OojOE_hkNrs6Q",
"fileSystemInfo" : {
"lastModifiedDateTime" : "2017-02-23T07:28:18.86Z",
"createdDateTime" : "2017-02-23T07:28:17.623Z"
},
"name" : "Open Notebook.onetoc2",
"webUrl" : "https://1drv.ms/o/s!AE59_g1ADtX0gR4",
"parentReference" : {
"name" : "foo",
"path" : "/drive/root:/onenote/foo",
"id" : "F4D50E400DFE7D4E!154",
"driveId" : "f4d50e400dfe7d4e"
},
"size" : 2885,
"createdDateTime" : "2017-02-23T07:28:17.623Z",
"createdBy" : {
"user" : {
"displayName" : "Fitz Elliott",
"id" : "f4d50e400dfe7d4e"
}
},
"eTag" : "aRjRENTBFNDAwREZFN0Q0RSExNTguNA",
"lastModifiedBy" : {
"user" : {
"displayName" : "Fitz Elliott",
"id" : "f4d50e400dfe7d4e"
}
},
"lastModifiedDateTime" : "2017-02-23T07:28:18.873Z"
},
{
"fileSystemInfo" : {
"lastModifiedDateTime" : "2017-02-23T07:28:30.647Z",
"createdDateTime" : "2017-02-23T07:28:14.373Z"
},
"name" : "foo.one",
"id" : "F4D50E400DFE7D4E!157",
"file" : {
"mimeType" : "application/msonenote"
},
"@content.downloadUrl" : "https://iphwow.bn1303.livefilestore.com/y4puP-eaKKsYhT-SUFQiQJWEAD7iZQ2_Gkp_Er8l7zsho8jmKqG7Qhm5UT0ndG0kr0uhB_yt7_7VdjwLmUNAzoviWWnORHJ8FdK0oEmwgKPB_jvAxPV7ozee5fGFX2JWlBsenzklMLAMuDRHDLKWAKGOogg2m5H5UBIzqkH1tC8B6XM-xLGPlGh7TQGdV99bmRbCjGSI2CI-vbeRXoutoORbw",
"webUrl" : "https://1drv.ms/o/s!AE59_g1ADtX0gR0",
"parentReference" : {
"path" : "/drive/root:/onenote/foo",
"id" : "F4D50E400DFE7D4E!154",
"name" : "foo",
"driveId" : "f4d50e400dfe7d4e"
},
"size" : 25474,
"createdBy" : {
"user" : {
"id" : "f4d50e400dfe7d4e",
"displayName" : "Fitz Elliott"
}
},
"createdDateTime" : "2017-02-23T07:28:14.373Z",
"lastModifiedDateTime" : "2017-02-23T07:28:30.663Z",
"lastModifiedBy" : {
"user" : {
"displayName" : "Fitz Elliott",
"id" : "f4d50e400dfe7d4e"
}
},
"eTag" : "aRjRENTBFNDAwREZFN0Q0RSExNTcuMjI"
}
],
"@odata.deltaLink" : "https://api.onedrive.com/v1.0/drives('me')/items('F4D50E400DFE7D4E!154')/view.delta?$top=250&token=aTE09NjM2MjY0ODMxODU0MTA7SUQ9RjRENTBFNDAwREZFN0Q0RSExNTQ7TFI9NjM2Mzg5MzczNzM0NjA7RVA9MTY7U0k9MjM7U0c9MTtTTz0yO1BJPTM",
"@odata.context" : "https://api.onedrive.com/v1.0/$metadata#drives('me')/items"
}
}
53 changes: 53 additions & 0 deletions tests/providers/onedrive/fixtures/paths.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
{
"deeply_nested_file_id": "F4D50E400DFE7D4E!299",
"deeply_nested_file_metadata": {
"id" : "F4D50E400DFE7D4E!299",
"createdBy" : {
"application" : {
"displayName" : "OneDrive",
"id" : "481710a4"
},
"user" : {
"id" : "f4d50e400dfe7d4e",
"displayName" : "Fitz Elliott"
}
},
"fileSystemInfo" : {
"lastModifiedDateTime" : "2017-08-21T20:48:50.636Z",
"createdDateTime" : "2017-08-21T20:48:38.633Z"
},
"children@odata.context" : "https://api.onedrive.com/v1.0/$metadata#drives('me')/items('F4D50E400DFE7D4E%21299')/children",
"file" : {
"mimeType" : "text/plain",
"hashes" : {
"sha1Hash" : "780892A03B54C6221AAD649266F85111EB707CE0"
}
},
"@odata.context" : "https://api.onedrive.com/v1.0/$metadata#drives('me')/items/$entity",
"eTag" : "aRjRENTBFNDAwREZFN0Q0RSEyOTkuMg",
"createdDateTime" : "2017-08-21T20:48:38.633Z",
"lastModifiedDateTime" : "2017-08-21T20:48:50.653Z",
"name" : "the kraken.txt",
"cTag" : "aYzpGNEQ1MEU0MDBERkU3RDRFITI5OS4yNTg",
"lastModifiedBy" : {
"user" : {
"displayName" : "Fitz Elliott",
"id" : "f4d50e400dfe7d4e"
},
"application" : {
"id" : "481710a4",
"displayName" : "OneDrive"
}
},
"parentReference" : {
"path" : "/drive/root:/deep/deeper/deepest/positively%20abyssyal",
"id" : "F4D50E400DFE7D4E!298",
"name" : "positively abyssyal",
"driveId" : "f4d50e400dfe7d4e"
},
"webUrl" : "https://1drv.ms/t/s!AE59_g1ADtX0gis",
"@content.downloadUrl" : "https://public.bn1303.livefilestore.com/y4mjtosOcbGBtNxYmp5-H-TYeT7TdFxv_EMev3KEQcOqMc_a6mKODjh0SOew6vLNy12kUopxRF3kihUHYY18zanCHKN3N7Wb28ppZmFGjQ4kA2RVrk7f2QqDpbA5VAxZ4zmqQcsl5aVYEH9_pCBwhhcJzTF-VQSZELL5dG4RdLPqQX4tUo8KEyonlWb0-uuR_7ssfZXTIgu5fIqGvskT882y2H3zOF8P6tSJAVVpvKuOxnXAIITn1ghKu1KlDpzktcPXmDkjY2sE_vRBn_5CM0zzg",
"children" : [],
"size" : 33
}
}
Loading

0 comments on commit 26bf209

Please sign in to comment.