Permalink
Browse files

Remove older tests

  • Loading branch information...
1 parent 7643048 commit 86c1e49a3ae7494cd61ea8d5b685322c27d906f2 @sergi sergi committed Oct 1, 2012
Showing with 0 additions and 133 deletions.
  1. +0 −133 test/test_ftp.js
View
133 test/test_ftp.js
@@ -67,104 +67,6 @@ module.exports = {
next();
},
- /**
- * User logs in and lists (first PROPFIND of basePath)
- * creates a folder in root
- * creates a file in it
- * creates a second folder in root
- * moves first folder in second
- * logs out
- */
- "!test Stateless requests on jsDav Ftp": function(next) {
- var _self = this;
- var options = _.extend(this.getHttpReqOptions(), {
- path: "/",
- method: "PROPFIND"
- });
-
- var request = Http.request(options);
- request.write('<?xml version="1.0" encoding="utf-8" ?><D:propfind xmlns:D="DAV:"><D:allprop /></D:propfind>');
- request.on("response", function(res) {
- res.on("data", function(buff) {
- xmlResponse = buff.toString();
- assert.ok(xmlResponse.indexOf("HTTP/1.1 200 Ok") > -1);
- afterPropfind.call(_self);
- });
- });
- request.end();
-
- function afterPropfind() {
- console.log("ASD")
- var successes = 0;
- var _self = this;
- // Request #1: creates a folder in root
- setTimeout(function() {
- options = _.extend(_self.getHttpReqOptions(["content-length"]), {
- path: "/New_Ftp_Folder",
- method: "MKCOL",
- headers: {
- "content-length": 0
- }
- });
- Http.request(options, function(res) {
- assert.equal(res.statusCode, 201);
- successes++;
- }).end();
- }, 100);
- // Request #2: creates a file in it
- setTimeout(function() {
- options = _.extend(_self.getHttpReqOptions(["content-length", "content-type"]), {
- path: "/New_Ftp_Folder/Untitled.js",
- method: "PUT",
- headers: {
- "content-length": 0,
- "content-type": "text/plain"
- }
- });
- Http.request(options, function(res) {
- assert.equal(res.statusCode, 201);
- successes++;
- }).end();
- }, 200);
- // Request #3: create a second folder in root
- setTimeout(function() {
- options = _.extend(_self.getHttpReqOptions(["content-length"]), {
- path: "/New_Ftp_Folder_2",
- method: "MKCOL",
- headers: {
- "content-length": 0
- }
- });
- Http.request(options, function(res) {
- assert.equal(res.statusCode, 201);
- successes++;
- }).end();
- }, 300);
- // Request #4: moves first folder into second
- setTimeout(function(){
- options = _.extend(_self.getHttpReqOptions(["content-length"]), {
- path: "/New_Ftp_Folder",
- method: "MOVE",
- headers: {
- "destination": "/New_Ftp_Folder_2/New_Ftp_Folder",
- "content-length": 0
- }
- });
- Http.request(options, function(res) {
- assert.equal(res.statusCode, 201);
- successes++;
- }).end();
- }, 400); // give a little time to run the two MKCOL requests first.
- var loop = setInterval(function() {
- console.log('Interval: Number of responses back...', successes);
- if (successes >= 4) {
- clearInterval(loop);
- next();
- }
- }, 1000);
- }
- },
-
"test getRealPath 1": function(next) {
var tree = new FtpTree({
ftp: {
@@ -193,41 +95,6 @@ module.exports = {
});
assert.equal(tree.getRealPath("/home"), "/home");
next();
- },
-
- getHttpReqOptions: function(exclude_headers, exclude) {
- var options = {
- host: "127.0.0.1",
- port: 8000,
- headers: {
- "accept": "*/*",
- //"Accept-Charset": "ISO-8859-1,utf-8;q=0.7,*;q=0.3",
- //"Accept-Encoding": "gzip,deflate,sdch",
- //"Accept-Language": "en-US,en;q=0.8",
- "connection": "keep-alive",
- "content-Length": 92,
- "content-type": "text/xml; charset=UTF-8",
- //"depth": 1,
- //"host": "localhost:5000",
- //"Origin": "http://localhost:5000",
- //"Referer": "http://localhost:5000/luismerino/ftp"
- //"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_7) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/13.0.782.41 Safari/535.1",
- //"X-Requested-With": "XMLHttpRequest"
- }
- };
- if (Array.isArray(exclude_headers)) {
- Object.keys(options.headers).forEach(function(key) {
- if (exclude_headers.indexOf(key) > -1)
- delete options.headers[key];
- });
- }
- if (Array.isArray(exclude)) {
- Object.keys(options).forEach(function(key) {
- if (exclude.indexOf(key) > -1)
- delete options[key];
- });
- }
- return options;
}
};

0 comments on commit 86c1e49

Please sign in to comment.