Skip to content

Commit

Permalink
Failing uri encode tests for getFile putFile
Browse files Browse the repository at this point in the history
  • Loading branch information
wlaurance committed Jul 17, 2013
1 parent 69fb61e commit e7d15f8
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 0 deletions.
15 changes: 15 additions & 0 deletions test.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,12 @@ describe('Faux-Knox', function(){
done();
});
});
it('should get a file that has a uri encoding', function(done){
client.getFile(encodeURIComponent('path/to encoded/json file.json'), null, function(err, cres){
cres.should.have.property('statusCode', 200);
done();
});
});
});
describe('putFile', function(){
it('should put a file into bucket', function(done){
Expand All @@ -67,6 +73,15 @@ describe('Faux-Knox', function(){
done();
});
});
it('should put a file into encoded path', function(done){
client.putFile('./test_files/put/fort_knox_tank.jpg', encodeURIComponent('from/a fort knox path/super tank.jpg'), function(err, res){
res.should.have.property('statusCode', 201);
fs.exists('./test_files/from/a fort knox path/super tank.jpg', function(existy){
existy.should.be.true;
done();
});
});
});
});
describe('putBuffer', function(){
it('should put a buffer where I tell it to', function(done){
Expand Down
34 changes: 34 additions & 0 deletions test_files/path/to encoded/json file.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"name": "faux-knox",
"version": "0.1.5",
"description": "Mock requests to knox module using file system",
"main": "index.js",
"scripts": {
"test": "./node_modules/.bin/mocha"
},
"repository": {
"type": "git",
"url": "git://github.com/wlaurance/faux-knox.git"
},
"keywords": [
"knox",
"mock"
],
"author": "Will S. Laurance",
"license": "BSD",
"readmeFilename": "README.md",
"gitHead": "cf1d54e5cf8ae5e6a6e2142ab42f7eb4a068147a",
"bugs": {
"url": "https://github.com/wlaurance/faux-knox/issues"
},
"devDependencies": {
"mocha": "~1.12.0",
"should": "~1.2.2"
},
"dependencies": {
"underscore": "~1.5.1",
"async": "~0.2.9",
"mkdirp": "~0.3.5",
"rimraf": "~2.2.1"
}
}

0 comments on commit e7d15f8

Please sign in to comment.