Commit 1d0a1be4 authored by lucas.parsy's avatar lucas.parsy

various fixes on gdriveStorage and his tests.

removed the removeAttachment method as it was useless.
removed error catching when user was doing request with invalid credentials.
throw error when doing a putAttachment on a folder.

changed varaiables names in test file to respect naming convention.
added/ removed tests following the changes on gdriveStorage file.

added tests verifying that the user can only put "enclosure"
as attachment name in putAttachment and getAttachment.
parent 96f23284
......@@ -34,12 +34,6 @@
404
);
}
if (error.target.status === 401) {
throw new jIO.util.jIOError(
"access token invalid or expired",
401
);
}
throw error;
}
......@@ -167,7 +161,13 @@
data: blob
});
})
.push(undefined, function (error) {handleError(error, id); });
.push(function (data) {
data = JSON.parse(data.target.responseText);
if (data.mimeType === "application/vnd.google-apps.folder") {
throw new jIO.util.jIOError("cannot put attachments to folder", 400);
}
return data;
}, function (error) {handleError(error, id); });
}
GdriveStorage.prototype.putAttachment = function (id, name, blob) {
......@@ -175,11 +175,6 @@
return sendData(id, blob, this._access_token);
};
GdriveStorage.prototype.removeAttachment = function (id, name) {
checkName(name);
return sendData(id, new Blob(), this._access_token);
};
GdriveStorage.prototype.remove = function (id) {
var that = this;
return new RSVP.Queue()
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment