Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: filefog/filefog
base: 390d346443
...
head fork: filefog/filefog
compare: b64076cbe9
  • 2 commits
  • 29 files changed
  • 0 commit comments
  • 1 contributor
Showing with 426 additions and 29 deletions.
  1. +2 −0  lib/box/box_client.js
  2. +2 −2 lib/box/box_provider.js
  3. +4 −0 lib/box/box_transform.js
  4. +7 −2 lib/dropbox/dropbox_client.js
  5. +2 −2 lib/dropbox/dropbox_provider.js
  6. +3 −1 lib/google_drive/google_drive_client.js
  7. +1 −1  lib/google_drive/google_drive_provider.js
  8. +9 −3 lib/main.js
  9. +5 −1 lib/skydrive/skydrive_client.js
  10. +2 −2 lib/skydrive/skydrive_provider.js
  11. +20 −0 test/box/box_client_spec.js
  12. +1 −1  test/box/box_provider_spec.js
  13. +17 −0 test/box/data/AccountInfoResponse.json
  14. +17 −0 test/box/data/CheckQuotaResponse.json
  15. +60 −0 test/box/data/CreateFileResponse.json
  16. +71 −0 test/box/data/CreateFolderResponse.json
  17. 0  test/box/data/DeleteFileResponse.json
  18. 0  test/box/data/DeleteFolderResponse.json
  19. +55 −0 test/box/data/GetFileInformationResponse.json
  20. +71 −0 test/box/data/GetFolderInformation.json
  21. +16 −0 test/box/data/RetrieveFolderItemsResponse.json
  22. +13 −0 test/dropbox/dropbox_client_spec.js
  23. +1 −1  test/dropbox/dropbox_provider_spec.js
  24. +15 −0 test/google_drive/google_drive_client_spec.js
  25. +1 −1  test/google_drive/google_drive_provider_spec.js
  26. +2 −2 test/main_spec.js
  27. +19 −0 test/skydrive/skydrive_client_spec.js
  28. +1 −1  test/skydrive/skydrive_provider_spec.js
  29. +9 −9 test/test_access_tokens.json
View
2  lib/box/box_client.js
@@ -172,6 +172,7 @@ module.exports = function (oauth_data, provider_options) {
})
}
this.GetFolderInformation = function (identifier) {
+ identifier = identifier || '0'
return getClient().then(function (client) {
var deferred = Q.defer();
client.get(
@@ -189,6 +190,7 @@ module.exports = function (oauth_data, provider_options) {
}
this.RetrieveFolderItems = function (identifier, options) {
+ identifier = identifier || '0'
return getClient().then(function (client) {
var deferred = Q.defer();
client.get(
View
4 lib/box/box_provider.js
@@ -14,7 +14,7 @@ exports.provider = function (provider_options) {
this.oAuthGetAuthorizeUrl = function oAuthGetAuthorizeUrl() {
return oauth2Client.getAuthorizeUrl({
- "redirect_uri": provider_options.redirect_url(provider_options.service_name),
+ "redirect_uri": provider_options.redirect_url,
"response_type": "code"
})
}
@@ -25,7 +25,7 @@ exports.provider = function (provider_options) {
code,
{
"grant_type": "authorization_code",
- "redirect_uri": provider_options.redirect_url(provider_options.service_name)
+ "redirect_uri": provider_options.redirect_url
},
function (err, access_token, refresh_token, results) {
var oauth_data = {'access_token': access_token, 'refresh_token': refresh_token, 'raw': results}
View
4 lib/box/box_transform.js
@@ -0,0 +1,4 @@
+
+
+
+
View
9 lib/dropbox/dropbox_client.js
@@ -162,12 +162,17 @@ module.exports = function (oauth_data, provider_options) {
});
}
this.DeleteFolder = this.DeleteFile;
- this.GetFolderInformation = this.GetFileInformation;
+ this.GetFolderInformation = function(identifier, options){
+ identifier = identifier || '';
+ return this.GetFileInformation(identifier, options)
+ }
this.RetrieveFolderItems = function (identifier) {
+ identifier = identifier || '';
+ var path = createPath(identifier)
return getClient().then(function (client) {
var deferred = Q.defer();
- client.readdir(identifier, function (err, content_array, folder_stat, content_stat_array) {
+ client.readdir(path, function (err, content_array, folder_stat, content_stat_array) {
err = errorHandler(err);
if (err) return deferred.reject(err);
return deferred.resolve({content_array: content_array, folder_stat: folder_stat, content_stat_array: content_stat_array});
View
4 lib/dropbox/dropbox_provider.js
@@ -18,7 +18,7 @@ exports.provider = function (provider_options) {
this.oAuthGetAuthorizeUrl = function oAuthGetAuthorizeUrl() {
return oauth2Client.getAuthorizeUrl({
- "redirect_uri": provider_options.redirect_url(provider_options.service_name),
+ "redirect_uri": provider_options.redirect_url,
"response_type": "code"
})
}
@@ -29,7 +29,7 @@ exports.provider = function (provider_options) {
code,
{
"grant_type": "authorization_code",
- "redirect_uri": provider_options.redirect_url(provider_options.service_name)
+ "redirect_uri": provider_options.redirect_url
},
function (err, access_token, refresh_token, results) {
var oauth_data = {'access_token': access_token, 'refresh_token': refresh_token, 'raw': results}
View
4 lib/google_drive/google_drive_client.js
@@ -5,7 +5,7 @@ var Q = require('q')
module.exports = function (oauth_data, provider_options) {
var _oauth_data = oauth_data;
- var _oauth2Client = new googleapis.OAuth2Client(provider_options.client_key, provider_options.client_secret, provider_options.redirect_url(provider_options.service_name));
+ var _oauth2Client = new googleapis.OAuth2Client(provider_options.client_key, provider_options.client_secret, provider_options.redirect_url);
_oauth2Client.credentials = _oauth_data;
var _googleClientPromise = null
@@ -101,6 +101,7 @@ module.exports = function (oauth_data, provider_options) {
})
}
this.GetFileInformation = function (identifier) {
+ identifier = identifier ||'root';
return getClient().then(function (client) {
var deferred = Q.defer();
client.drive.files
@@ -136,6 +137,7 @@ module.exports = function (oauth_data, provider_options) {
this.GetFolderInformation = this.GetFileInformation;
this.RetrieveFolderItems = function (identifier) {
+ identifier = identifier ||'root';
return getClient().then(function (client) {
var deferred = Q.defer();
client.drive.children
View
2  lib/google_drive/google_drive_provider.js
@@ -7,7 +7,7 @@ exports.provider = function (provider_options) {
//https://developers.google.com/apis-explorer/#p/drive/v2/
//https://github.com/google/google-api-nodejs-client/
var oauth2Client = new googleapis.OAuth2Client(provider_options.client_key,
- provider_options.client_secret, provider_options.redirect_url(provider_options.service_name));
+ provider_options.client_secret, provider_options.redirect_url);
this.oAuthGetAuthorizeUrl = function oAuthGetAuthorizeUrl() {
return oauth2Client.generateAuthUrl({ access_type: 'offline', scope: provider_options.client_scope });
}
View
12 lib/main.js
@@ -33,11 +33,17 @@ exports.setConfig = function (new_config) {
config = extend(true, config, new_config);
};
-function redirect_url(service){
+var redirect_url_generator = function (service){
var service_name = service.toLowerCase();
return 'http://www.example.com:3000/service/callback/' + service_name
}
-exports.redirect_url = redirect_url;
+
+exports.getRedirectUrlGenerator = function(){
+ return redirect_url_generator
+}
+exports.setRedirectUrlGenerator = function(fn){
+ redirect_url_generator = fn;
+}
function generateProviderOptions(service,provider_options){
//provider_options.client_key
@@ -48,7 +54,7 @@ function generateProviderOptions(service,provider_options){
provider_options = provider_options || {};
provider_options = extend(true, config[service], provider_options);
provider_options.service_name = service;
- provider_options.redirect_url = provider_options.redirect_url || redirect_url;
+ provider_options.redirect_url = provider_options.redirect_url || redirect_url_generator(service);
return provider_options;
}
exports.generateProviderOptions = generateProviderOptions;
View
6 lib/skydrive/skydrive_client.js
@@ -133,6 +133,7 @@ module.exports = function (oauth_data, provider_options) {
}
this.CreateFolder = function (folderName, parentIdentifier, options) {
+ parentIdentifier = parentIdentifier || 'me/skydrive/'
return getClient().then(function (client) {
var deferred = Q.defer();
client.post(
@@ -141,7 +142,7 @@ module.exports = function (oauth_data, provider_options) {
'Authorization': 'Bearer ' + _oauth_data.access_token,
'content-type': 'application/json'
},
- url: 'https://apis.live.net/v5.0/' + (parentIdentifier || 'me/skydrive/'),
+ url: 'https://apis.live.net/v5.0/' + parentIdentifier,
body: '{"name":"' + folderName + '", "description": "A test folder"}'
},
function (err, r, body) {
@@ -155,6 +156,7 @@ module.exports = function (oauth_data, provider_options) {
}
this.DeleteFolder = function (identifier) {
+ identifier = identifier || 'me/skydrive'
return getClient().then(function (client) {
var deferred = Q.defer();
client.del(
@@ -171,6 +173,7 @@ module.exports = function (oauth_data, provider_options) {
})
}
this.GetFolderInformation = function (identifier) {
+ identifier = identifier || 'me/skydrive'
return getClient().then(function (client) {
var deferred = Q.defer();
client.get(
@@ -187,6 +190,7 @@ module.exports = function (oauth_data, provider_options) {
})
}
this.RetrieveFolderItems = function (identifier, options) {
+ identifier = identifier || 'me/skydrive'
return getClient().then(function (client) {
var deferred = Q.defer();
client.get(
View
4 lib/skydrive/skydrive_provider.js
@@ -15,7 +15,7 @@ exports.provider = function (provider_options) {
this.oAuthGetAuthorizeUrl = function oAuthGetAuthorizeUrl() {
return oauth2Client.getAuthorizeUrl({
- "redirect_uri": provider_options.redirect_url(provider_options.service_name),
+ "redirect_uri": provider_options.redirect_url,
"response_type": "code",
"scope": provider_options.client_scope
@@ -29,7 +29,7 @@ exports.provider = function (provider_options) {
code,
{
"grant_type": "authorization_code",
- "redirect_uri": provider_options.redirect_url(provider_options.service_name)
+ "redirect_uri": provider_options.redirect_url
},
function (err, access_token, refresh_token, results) {
var oauth_data = {'access_token': access_token, 'refresh_token': refresh_token, 'raw': results}
View
20 test/box/box_client_spec.js
@@ -43,6 +43,7 @@ describe('Box Client', function () {
it('should successfully Create file in root directory', function () {
return Client.CreateFile(testFileName, null, new Buffer(testFileContent)).then(function (response) {
+ console.log("create file:", response.body)
var resp_json = JSON.parse(response.body);
assert.equal(resp_json.entries[0].type, "file");
assert.equal(resp_json.entries[0].name, testFileName);
@@ -52,6 +53,7 @@ describe('Box Client', function () {
it('should successfully Read file metadata', function () {
return Client.GetFileInformation(testFileID).then(function (response) {
+ console.log("file information:", response.body)
var resp_json = JSON.parse(response.body);
assert.equal(resp_json.type, "file");
assert.equal(resp_json.name, testFileName);
@@ -66,6 +68,7 @@ describe('Box Client', function () {
it('should successfully Delete file', function () {
return Client.DeleteFile(testFileID).then(function (response) {
+ console.log("delete file:", response.body)
assert.equal(response.body, '');
//TODO: check the header for 204 response
})
@@ -84,6 +87,23 @@ describe('Box Client', function () {
})
})
+ describe('when no identifiers provided', function(){
+ it('should successfully get root folder information', function () {
+ return Client.GetFolderInformation().then(function (response) {
+ var resp_json = JSON.parse(response.body);
+ assert.equal(resp_json.type, "folder");
+ })
+ })
+
+ it('should successfully Read root folder metadata', function () {
+ return Client.RetrieveFolderItems().then(function (response) {
+ var resp_json = JSON.parse(response.body);
+ assert.equal(resp_json.total_count, 0);
+ assert.deepEqual(resp_json.entries, []);
+ })
+ })
+ })
+
it('should successfully Create folder in root directory', function () {
return Client.CreateFolder(testFolderName).then(function (response) {
var resp_json = JSON.parse(response.body);
View
2  test/box/box_provider_spec.js
@@ -17,7 +17,7 @@ describe('Box Provider', function () {
it('should generate oauth authorize Url', function () {
var parsed = require('url').parse(Provider.oAuthGetAuthorizeUrl(), true);
assert.equal(parsed.hostname, "www.box.com")
- assert.equal(parsed.query.redirect_uri, FileFog.redirect_url('box'))
+ assert.equal(parsed.query.redirect_uri, FileFog.getRedirectUrlGenerator()('box'))
assert.equal(parsed.query.response_type, "code")
assert.equal(parsed.query.client_id, "")
})
View
17 test/box/data/AccountInfoResponse.json
@@ -0,0 +1,17 @@
+{
+ "type": "user",
+ "id": "210924315",
+ "name": "FileFog Test",
+ "login": "filefogtest@gmail.com",
+ "created_at": "2014-02-01T21:35:38-08:00",
+ "modified_at": "2014-02-27T16:12:40-08:00",
+ "language": "en",
+ "space_amount": 10737418240,
+ "space_used": 0,
+ "max_upload_size": 262144000,
+ "status": "active",
+ "job_title": "",
+ "phone": "14153732815",
+ "address": "",
+ "avatar_url": "https://app.box.com/api/avatar/large/210924315"
+}
View
17 test/box/data/CheckQuotaResponse.json
@@ -0,0 +1,17 @@
+{
+ "type": "user",
+ "id": "210924315",
+ "name": "FileFog Test",
+ "login": "filefogtest@gmail.com",
+ "created_at": "2014-02-01T21:35:38-08:00",
+ "modified_at": "2014-02-27T16:12:40-08:00",
+ "language": "en",
+ "space_amount": 10737418240,
+ "space_used": 0,
+ "max_upload_size": 262144000,
+ "status": "active",
+ "job_title": "",
+ "phone": "14153732815",
+ "address": "",
+ "avatar_url": "https://app.box.com/api/avatar/large/210924315"
+}
View
60 test/box/data/CreateFileResponse.json
@@ -0,0 +1,60 @@
+{
+ "total_count": 1,
+ "entries": [
+ {
+ "type": "file",
+ "id": "14805613466",
+ "sequence_id": "0",
+ "etag": "0",
+ "sha1": "ae5cd92fc059f41e745ee06174bff7504fa68b93",
+ "name": "d74e7107-d8b4-4407-5add-91e434c08f4b_test.txt",
+ "description": "",
+ "size": 20,
+ "path_collection": {
+ "total_count": 1,
+ "entries": [
+ {
+ "type": "folder",
+ "id": "0",
+ "sequence_id": null,
+ "etag": null,
+ "name": "All Files"
+ }
+ ]
+ },
+ "created_at": "2014-02-27T14:33:47-08:00",
+ "modified_at": "2014-02-27T14:33:47-08:00",
+ "trashed_at": null,
+ "purged_at": null,
+ "content_created_at": "2014-02-27T14:33:47-08:00",
+ "content_modified_at": "2014-02-27T14:33:47-08:00",
+ "created_by": {
+ "type": "user",
+ "id": "210924315",
+ "name": "FileFog Test",
+ "login": "filefogtest@gmail.com"
+ },
+ "modified_by": {
+ "type": "user",
+ "id": "210924315",
+ "name": "FileFog Test",
+ "login": "filefogtest@gmail.com"
+ },
+ "owned_by": {
+ "type": "user",
+ "id": "210924315",
+ "name": "FileFog Test",
+ "login": "filefogtest@gmail.com"
+ },
+ "shared_link": null,
+ "parent": {
+ "type": "folder",
+ "id": "0",
+ "sequence_id": null,
+ "etag": null,
+ "name": "All Files"
+ },
+ "item_status": "active"
+ }
+ ]
+}
View
71 test/box/data/CreateFolderResponse.json
@@ -0,0 +1,71 @@
+{
+ "type": "folder",
+ "id": "1681749076",
+ "sequence_id": "0",
+ "etag": "0",
+ "name": "77482aa0-b9ba-5dae-0245-d1e4871c7a9a_test",
+ "created_at": "2014-02-27T16:12:41-08:00",
+ "modified_at": "2014-02-27T16:12:41-08:00",
+ "description": "",
+ "size": 0,
+ "path_collection": {
+ "total_count": 1,
+ "entries": [
+ {
+ "type": "folder",
+ "id": "0",
+ "sequence_id": null,
+ "etag": null,
+ "name": "All Files"
+ }
+ ]
+ },
+ "created_by": {
+ "type": "user",
+ "id": "210924315",
+ "name": "FileFog Test",
+ "login": "filefogtest@gmail.com"
+ },
+ "modified_by": {
+ "type": "user",
+ "id": "210924315",
+ "name": "FileFog Test",
+ "login": "filefogtest@gmail.com"
+ },
+ "trashed_at": null,
+ "purged_at": null,
+ "content_created_at": "2014-02-27T16:12:41-08:00",
+ "content_modified_at": "2014-02-27T16:12:41-08:00",
+ "owned_by": {
+ "type": "user",
+ "id": "210924315",
+ "name": "FileFog Test",
+ "login": "filefogtest@gmail.com"
+ },
+ "shared_link": null,
+ "folder_upload_email": null,
+ "parent": {
+ "type": "folder",
+ "id": "0",
+ "sequence_id": null,
+ "etag": null,
+ "name": "All Files"
+ },
+ "item_status": "active",
+ "item_collection": {
+ "total_count": 0,
+ "entries": [],
+ "offset": 0,
+ "limit": 100,
+ "order": [
+ {
+ "by": "type",
+ "direction": "ASC"
+ },
+ {
+ "by": "name",
+ "direction": "ASC"
+ }
+ ]
+ }
+}
View
0  test/box/data/DeleteFileResponse.json
No changes.
View
0  test/box/data/DeleteFolderResponse.json
No changes.
View
55 test/box/data/GetFileInformationResponse.json
@@ -0,0 +1,55 @@
+{
+ "type": "file",
+ "id": "14805613466",
+ "sequence_id": "0",
+ "etag": "0",
+ "sha1": "ae5cd92fc059f41e745ee06174bff7504fa68b93",
+ "name": "d74e7107-d8b4-4407-5add-91e434c08f4b_test.txt",
+ "description": "",
+ "size": 20,
+ "path_collection": {
+ "total_count": 1,
+ "entries": [
+ {
+ "type": "folder",
+ "id": "0",
+ "sequence_id": null,
+ "etag": null,
+ "name": "All Files"
+ }
+ ]
+ },
+ "created_at": "2014-02-27T14:33:47-08:00",
+ "modified_at": "2014-02-27T14:33:47-08:00",
+ "trashed_at": null,
+ "purged_at": null,
+ "content_created_at": "2014-02-27T14:33:47-08:00",
+ "content_modified_at": "2014-02-27T14:33:47-08:00",
+ "created_by": {
+ "type": "user",
+ "id": "210924315",
+ "name": "FileFog Test",
+ "login": "filefogtest@gmail.com"
+ },
+ "modified_by": {
+ "type": "user",
+ "id": "210924315",
+ "name": "FileFog Test",
+ "login": "filefogtest@gmail.com"
+ },
+ "owned_by": {
+ "type": "user",
+ "id": "210924315",
+ "name": "FileFog Test",
+ "login": "filefogtest@gmail.com"
+ },
+ "shared_link": null,
+ "parent": {
+ "type": "folder",
+ "id": "0",
+ "sequence_id": null,
+ "etag": null,
+ "name": "All Files"
+ },
+ "item_status": "active"
+}
View
71 test/box/data/GetFolderInformation.json
@@ -0,0 +1,71 @@
+{
+ "type": "folder",
+ "id": "1681749076",
+ "sequence_id": "0",
+ "etag": "0",
+ "name": "77482aa0-b9ba-5dae-0245-d1e4871c7a9a_test",
+ "created_at": "2014-02-27T16:12:41-08:00",
+ "modified_at": "2014-02-27T16:12:41-08:00",
+ "description": "",
+ "size": 0,
+ "path_collection": {
+ "total_count": 1,
+ "entries": [
+ {
+ "type": "folder",
+ "id": "0",
+ "sequence_id": null,
+ "etag": null,
+ "name": "All Files"
+ }
+ ]
+ },
+ "created_by": {
+ "type": "user",
+ "id": "210924315",
+ "name": "FileFog Test",
+ "login": "filefogtest@gmail.com"
+ },
+ "modified_by": {
+ "type": "user",
+ "id": "210924315",
+ "name": "FileFog Test",
+ "login": "filefogtest@gmail.com"
+ },
+ "trashed_at": null,
+ "purged_at": null,
+ "content_created_at": "2014-02-27T16:12:41-08:00",
+ "content_modified_at": "2014-02-27T16:12:41-08:00",
+ "owned_by": {
+ "type": "user",
+ "id": "210924315",
+ "name": "FileFog Test",
+ "login": "filefogtest@gmail.com"
+ },
+ "shared_link": null,
+ "folder_upload_email": null,
+ "parent": {
+ "type": "folder",
+ "id": "0",
+ "sequence_id": null,
+ "etag": null,
+ "name": "All Files"
+ },
+ "item_status": "active",
+ "item_collection": {
+ "total_count": 0,
+ "entries": [],
+ "offset": 0,
+ "limit": 100,
+ "order": [
+ {
+ "by": "type",
+ "direction": "ASC"
+ },
+ {
+ "by": "name",
+ "direction": "ASC"
+ }
+ ]
+ }
+}
View
16 test/box/data/RetrieveFolderItemsResponse.json
@@ -0,0 +1,16 @@
+{
+ "total_count": 0,
+ "entries": [],
+ "offset": 0,
+ "limit": 100,
+ "order": [
+ {
+ "by": "type",
+ "direction": "ASC"
+ },
+ {
+ "by": "name",
+ "direction": "ASC"
+ }
+ ]
+}
View
13 test/dropbox/dropbox_client_spec.js
@@ -78,6 +78,19 @@ describe('Dropbox Client', function () {
done();
})
})
+ describe('when no identifiers provided', function(){
+ it('should successfully get root folder information', function () {
+ return Client.GetFolderInformation().then(function (response) {
+ assert(response.isFolder);
+ assert.equal(response.path, '');
+ })
+ })
+
+ it('should successfully Read root folder metadata', function () {
+ return Client.RetrieveFolderItems().then(function (response) {
+ })
+ })
+ })
it('should successfully Create folder in root directory', function () {
return Client.CreateFolder(testFolderName).then(function (response) {
View
2  test/dropbox/dropbox_provider_spec.js
@@ -19,7 +19,7 @@ describe('Dropbox Provider', function () {
it('should generate oauth authorize Url', function () {
var parsed = require('url').parse(Provider.oAuthGetAuthorizeUrl(), true);
assert.equal(parsed.hostname, "www.dropbox.com")
- assert.equal(parsed.query.redirect_uri, FileFog.redirect_url('dropbox'))
+ assert.equal(parsed.query.redirect_uri, FileFog.getRedirectUrlGenerator()('dropbox'))
assert.equal(parsed.query.response_type, "code")
assert.equal(parsed.query.client_id, "sl47p7pijvtp73h")
})
View
15 test/google_drive/google_drive_client_spec.js
@@ -86,6 +86,21 @@ describe('Google Client', function () {
})
})
+ describe('when no identifiers provided', function(){
+ it('should successfully get root folder information', function () {
+ return Client.GetFolderInformation().then(function (response) {
+ assert.equal(response.mimeType, 'application/vnd.google-apps.folder');
+ assert.equal(response.title, 'My Drive');
+ })
+ })
+
+ it('should successfully Read root folder metadata', function () {
+ return Client.RetrieveFolderItems().then(function (response) {
+ assert.equal(response.kind, 'drive#childList');
+ })
+ })
+ })
+
it('should successfully Create folder in root directory', function () {
return Client.CreateFolder(testFolderName).then(function (response) {
assert.equal(response.mimeType, 'application/vnd.google-apps.folder');
View
2  test/google_drive/google_drive_provider_spec.js
@@ -17,7 +17,7 @@ describe('Google Provider', function () {
it('should generate oauth authorize Url', function () {
var parsed = require('url').parse(Provider.oAuthGetAuthorizeUrl(), true);
assert.equal(parsed.hostname, "accounts.google.com")
- assert.equal(parsed.query.redirect_uri, FileFog.redirect_url('google'))
+ assert.equal(parsed.query.redirect_uri, FileFog.getRedirectUrlGenerator()('google'))
assert.equal(parsed.query.response_type, "code")
assert.equal(parsed.query.access_type, "offline")
assert.equal(parsed.query.client_id, "777041726477-a5o1tp6f3i9m1me3tj5vhpnrn1jge43c.apps.googleusercontent.com")
View
4 test/main_spec.js
@@ -75,7 +75,7 @@ describe('Config', function () {
"client_key": '',
"client_secret": '',
"client_scope": "wl.basic wl.emails wl.offline_access wl.skydrive_update",
- "redirect_url": FileFog.redirect_url
+ "redirect_url": FileFog.getRedirectUrlGenerator()("skydrive")
});
})
@@ -85,7 +85,7 @@ describe('Config', function () {
"client_key": 'test_key',
"client_secret": 'test_secret',
"client_scope": "wl.basic wl.emails wl.offline_access wl.skydrive_update",
- "redirect_url": FileFog.redirect_url
+ "redirect_url": FileFog.getRedirectUrlGenerator()("skydrive")
});
})
})
View
19 test/skydrive/skydrive_client_spec.js
@@ -94,6 +94,25 @@ describe('Skydrive Client', function () {
})
})
+ describe('when no identifiers provided', function(){
+ it('should successfully get root folder information', function () {
+ return Client.GetFolderInformation().then(function (response) {
+ console.log(response.body)
+ var resp_json = JSON.parse(response.body);
+ assert.equal(resp_json.type, "folder");
+ assert.equal(resp_json.name, "SkyDrive");
+ })
+ })
+
+ it('should successfully Read root folder metadata', function () {
+ return Client.RetrieveFolderItems().then(function (response) {
+ var resp_json = JSON.parse(response.body);
+ //assert.equal(resp_json.count, 0);
+ //assert.deepEqual(resp_json.data, []);
+ })
+ })
+ })
+
it('should successfully Create folder in root directory', function () {
return Client.CreateFolder(testFolderName).then(function (response) {
var resp_json = JSON.parse(response.body);
View
2  test/skydrive/skydrive_provider_spec.js
@@ -17,7 +17,7 @@ describe('SkyDrive Provider', function () {
it('should generate oauth authorize Url', function () {
var parsed = require('url').parse(Provider.oAuthGetAuthorizeUrl(), true);
assert.equal(parsed.hostname, "login.live.com")
- assert.equal(parsed.query.redirect_uri, FileFog.redirect_url('skydrive'))
+ assert.equal(parsed.query.redirect_uri, FileFog.getRedirectUrlGenerator()('skydrive'))
assert.equal(parsed.query.response_type, "code")
assert.equal(parsed.query.client_id, "000000004C10EA03")
assert.equal(parsed.query.scope, 'wl.basic wl.emails wl.offline_access wl.skydrive_update')
View
18 test/test_access_tokens.json
@@ -8,30 +8,30 @@
}
},
"box": {
- "access_token": "jcsoCI3f4pLNkTrk8riUEZXZw02fRJSZ",
- "refresh_token": "0YoLb35ny8QlFdQTjfdlAYeFtVuE9FLa8EsA79kFdExANv7WMez3V5hdioACBuvF",
+ "access_token": "rhqi7CkeAG5Ll2Rvs8U5JUWPgvswuc9P",
+ "refresh_token": "RybZ0pTg0ts6Eb9vgD5R1OQD9Wx9wiTGtmamq3Cl1lULQDFKnXm8KH6CCA7q9Czu",
"raw": {
- "access_token": "jcsoCI3f4pLNkTrk8riUEZXZw02fRJSZ",
- "expires_in": 3897,
+ "access_token": "rhqi7CkeAG5Ll2Rvs8U5JUWPgvswuc9P",
+ "expires_in": 4132,
"restricted_to": [],
"token_type": "bearer"
}
},
"google": {
- "access_token": "ya29.1.AADtN_Xceikb99OxQrT3prwlaQkRMOJ2QPYEQImDpJc6eYm-73R5ptQLw8qx3R8SlRzZxZE",
+ "access_token": "ya29.1.AADtN_Uhiql_OeiFuDH7zENKXM3wK5nFoYrWmAROeOlEK8Fay_vlwp-QplB4xobcF3MmPKCA",
"token_type": "Bearer",
"expires_in": 3600,
"refresh_token": "1/IMcWJR9KJPVguuKLUrHzMjRl-XECLf6mK2YoUYnbQaU"
},
"skydrive": {
- "access_token": "EwA4Aq1DBAAUGCCXc8wU/zFu9QnLdZXy+YnElFkAAZxRnm23I3huRVAH8KixauYYGb3lUGOzvRRdAdaqS86KJ24N0ZFJotOOst3xz6w+wawbhv4AJEwqEl4S1E3hPCz+1Wx9M3m4PeM4SETQDZhF6cbS8BQhBl9SREDhw+UuPq1tdCVCaQBg8DYrQ8z0LMloX1dkH0iwyRgM+U5e62tdfdydhMZa/G3tzmpA0Gl2CotWsokWHbsvf4DbsfJRpiV/t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meNowIxM4askRrdNeL8/vg0JzUDzHdS18GzNzz9S0p+CnjJ6rFLUhzITgGoP6A+EuFUvxhkipWQumRHqkBsWhWcFbf2vki2XHU5s7Q4uQaREe1rymCDE4ZnXybUQs5+hRZlygTbRukgecO2pJcoVn6TavhmbQ1pAs/VUf43ZucMZysB/p+mZ88YXRP07GWu+0hnA8gdWA1EVfGmK4imEOWfs14Cf89D5lUcXvXc71eaB8DZgAACE1qRJMMnVpoCAGMgLECDWW0sAl30xvLfYSubrQDsa4/PyI0URJLhuWfWLdr74SbxDoggHJ4MsnyJC1aSSDcfyhRCzebDRdRm/LIf1VDBNY9VHJ3fXszEUMD9NrEAz7hLig8CwHi8XyH28/6Nq07JxYzrTcC83nGiBtLlVnenJ8w0FnfWPBVLf/2Ne8cnLHARFq3LNtL238u5BoDz0So+bp7pulWu1UcGg79HgfoK7REc1Js2DGb11BFlzjTRRqCqWX4MPQ3lbMh0hr0DntiUdYfqh+0x2p3d4ZxUI1nYv3CZ3izXW0nO7Tkg5Og2K5k3IUvbV6OY9gPLXVKTf1LVGxW/F0OPPmfMengpNvOd5quJNcAAA==",
+ "refresh_token": "CgqdLyOP13KUIX8Yg98W!9fCZ2NuIOkjEmwOnS3YrRo5qfO5sP8OFLB6*AwRO7taD8rg8yxiF0qI3LRzrWB3qMOf9T4orPKXiUvgBaQHgaqSheNxXHX3eXPi3!cp1b0O7Rhw2LfMOdPxUq8bYLGQfb1zap8muMLiNJ9T*o*7xs9ndJxSYrMSnQo5ZpEHrHk6nTpIwmH*363IMhP7QMBfg59I!5dhIfGpsLRgC*LlQvBdJh!tj99gWGHlCXKk3kn3OVX0y1GZeQni0j9313HV7519iMdP8CBM92sgcTo3TuRp9jVHyUmXY1gdEKv6jAVC*QGoQH5etEJHmg!jnjyBHsgw*TZVxK697193HINPQ2eMTwBphgYj5pb283Utmisuvnyn1uBcjlMYSVZjZsEiZz4$",
"raw": {
"token_type": "bearer",
"expires_in": 3600,
"scope": "wl.basic wl.emails wl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QiOiJ3d3cuZXhhbXBsZS5lZHUiLCJ1cm46bWljcm9zb2Z0OmFwcHVyaSI6ImFwcGlkOi8vMDAwMDAwMDA0QzEwRUEwMyIsInVybjptaWNyb3NvZnQ6YXBwaWQiOiIwMDAwMDAwMDRDMTBFQTAzIn0.wbbZXRGX88oRIptjMKYfBsk6caTVFwUT-N90kyStnt4"
}
}
}

No commit comments for this range

Something went wrong with that request. Please try again.