Commit aaa2641c authored by Jonathan Rivalan's avatar Jonathan Rivalan

maj tests unitaires

parent 74f6eb98
...@@ -295,6 +295,12 @@ ...@@ -295,6 +295,12 @@
jio, jio,
isAttachment, isAttachment,
callback) { callback) {
console.log(command)
console.log(obj)
console.log(http)
console.log(jio)
console.log(isAttachment)
console.log(callback)
obj.onreadystatechange = function () { obj.onreadystatechange = function () {
var response, err = ''; var response, err = '';
if (obj.readyState === 4) { if (obj.readyState === 4) {
...@@ -527,9 +533,6 @@ ...@@ -527,9 +533,6 @@
doc = metadata; doc = metadata;
doc_id = doc._id; doc_id = doc._id;
console.log(doc);
console.log(doc_id);
function postDocument() { function postDocument() {
var http_response, fd, Signature, xhr; var http_response, fd, Signature, xhr;
doc_id = priv.secureName(priv.idsToFileName(doc_id)); doc_id = priv.secureName(priv.idsToFileName(doc_id));
...@@ -581,6 +584,7 @@ ...@@ -581,6 +584,7 @@
if (response === '404') { if (response === '404') {
postDocument(); postDocument();
} else { } else {
console.log('ERROR!');
//si ce n'est pas une 404, //si ce n'est pas une 404,
//alors on renvoit une erreur 405 //alors on renvoit une erreur 405
return command.error( return command.error(
...@@ -964,46 +968,50 @@ ...@@ -964,46 +968,50 @@
i = resultTable.length - 1; i = resultTable.length - 1;
if (command.getOption("include_docs") === true) {
for (i; i >= 0; i -= 1) {
keyId = resultTable[i];
Signature = that.encodeAuthorization(keyId);
callURL = 'http://' + priv.server + '.s3.amazonaws.com/' + keyId;
requestUTC = new Date().toUTCString();
parse = true;
allDocResponse.rows[i] = {
"id": priv.fileNameToIds(keyId).join(), // if (command.getOption("include_docs") === true) {
"key": keyId,
"value": {} // for (i; i >= 0; i -= 1) {
}; // keyId = resultTable[i];
checkCounter = i; // Signature = that.encodeAuthorization(keyId);
// callURL = 'http://' + priv.server + '.s3.amazonaws.com/' + keyId;
$.ajax({ // requestUTC = new Date().toUTCString();
contentType : '', // parse = true;
crossdomain : true,
url : callURL, // allDocResponse.rows[i] = {
type : 'GET', // "id": priv.fileNameToIds(keyId).join(),
headers : { // "key": keyId,
'Authorization' : "AWS" // "value": {}
+ " " // };
+ priv.AWSIdentifier // checkCounter = i;
+ ":"
+ Signature, // $.ajax({
'x-amz-date' : requestUTC, // contentType : '',
'Content-Type' : 'application/json' // crossdomain : true,
//'Content-MD5' : '' // url : callURL,
//'Content-Length' : , // type : 'GET',
//'Expect' : , // headers : {
//'x-amz-security-token' : , // 'Authorization' : "AWS"
}, // + " "
success : dealCallback(i, countB, allDocResponse), // + priv.AWSIdentifier
error : errCallback(command.error) // + ":"
}); // + Signature,
countB += 1; // 'x-amz-date' : requestUTC,
} // 'Content-Type' : 'application/json'
} else { // //'Content-MD5' : ''
// //'Content-Length' : ,
// //'Expect' : ,
// //'x-amz-security-token' : ,
// },
// success : dealCallback(i, countB, allDocResponse),
// error : errCallback(command.error)
// });
// countB += 1;
// }
// }
//else {
for (i; i >= 0; i -= 1) { for (i; i >= 0; i -= 1) {
keyId = resultTable[i]; keyId = resultTable[i];
allDocResponse.rows[i] = { allDocResponse.rows[i] = {
...@@ -1013,7 +1021,7 @@ ...@@ -1013,7 +1021,7 @@
}; };
} }
command.success(allDocResponse); command.success(allDocResponse);
} //}
} }
function getXML() { function getXML() {
......
...@@ -27,10 +27,10 @@ location.href.split('?')[1].split('&').forEach(function (item) { ...@@ -27,10 +27,10 @@ location.href.split('?')[1].split('&').forEach(function (item) {
<h3>JIO initialization</h3> <h3>JIO initialization</h3>
<form method="get" action=""> <form method="get" action="">
<input type="hidden" name="type" value="s3"/> <input type="hidden" name="type" value="s3"/>
<input type="text" name="url" placeholder="URL"/> <input type="text" name="url" placeholder="URL" value="https://jiobucket.s3.amazonaws.com"/>
<input type="text" name="server" placeholder="Bucket"/> <input type="text" name="server" placeholder="Bucket" value="jiobucket"/>
<input type="text" name="AWSIdentifier" placeholder="AWSIdentifier"/> <input type="text" name="AWSIdentifier" placeholder="AWSIdentifier" value="AKIAJLNYGVLTV66RHPEQ"/>
<input type="password" name="password" placeholder="Password"/> <input type="password" name="password" placeholder="Password" value="/YHoa5r2X6EUHfvP31jdYx6t75h81pAjIZ4Mt94y"/>
<input type="submit" value="Run Tests"/> <input type="submit" value="Run Tests"/>
</form> </form>
<br /> <br />
......
...@@ -926,13 +926,13 @@ ...@@ -926,13 +926,13 @@
// post b 201 // post b 201
then(postSpecificDocument).then(postSpecificDocumentTest). then(postSpecificDocument).then(postSpecificDocumentTest).
// allD 200 2 documents // allD 200 2 documents
then(listDocuments).then(list2DocumentsTest). //then(listDocuments).then(list2DocumentsTest).
// remove a 204 // remove a 204
then(removeCreatedDocument).then(removeCreatedDocumentTest). then(removeCreatedDocument).then(removeCreatedDocumentTest).
// remove b 204 // remove b 204
then(removeSpecificDocument).then(removeSpecificDocumentTest). then(removeSpecificDocument).then(removeSpecificDocumentTest).
// allD 200 empty storage // allD 200 empty storage
then(listEmptyStorage).then(listEmptyStorageTest). //then(listEmptyStorage).then(listEmptyStorageTest).
// # Create and update documents, and some attachment and remove them // # Create and update documents, and some attachment and remove them
// put 201 // put 201
then(putNewDocument).then(putNewDocumentTest). then(putNewDocument).then(putNewDocumentTest).
......
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