Merge pull request #1913 from matiu/feature/quota

Feature/quota
This commit is contained in:
Gustavo Maximiliano Cortez 2014-12-02 09:46:11 -03:00
commit 17614d2968
13 changed files with 162 additions and 32 deletions

View file

@ -12,6 +12,7 @@ describe('insight storage plugin', function() {
var password = '1234';
var data = '{"random": true}';
var headers = 'X-test: 12\r\nX-testb: 32';
var namespace = 'profile::0000000000000000000000000000000000000000';
var oldSecret = 'rFA+F/N+ZvKXp717zBdfCKYQ5v9Fjry0W6tautj5etIH' + 'KLQliZBEYXA7AXjTJ9K3DglzGWJKost3QJUCMbhM/A=='
@ -47,7 +48,8 @@ describe('insight storage plugin', function() {
var setupForRetrieval = function() {
requestMock.get.onFirstCall().callsArgWith(1, null, {
statusCode: 200
statusCode: 200,
getAllResponseHeaders: sinon.stub().returns(headers),
}, data);
};
@ -62,6 +64,20 @@ describe('insight storage plugin', function() {
});
});
it('should be able to retrieve headers', function(done) {
setupForRetrieval();
storage.getItem(namespace, function(err, retrieved, headers) {
assert(!err);
headers['X-test'].should.equal('12');
headers['X-testb'].should.equal('32');
return done();
});
});
var setupForSave = function() {
requestMock.post.onFirstCall().callsArgWith(1, null, {
statusCode: 200
@ -106,11 +122,13 @@ describe('insight storage plugin', function() {
statusCode: 403
});
requestMock.get.onSecondCall().callsArgWith(1, null, {
statusCode: 200
statusCode: 200,
getAllResponseHeaders: sinon.stub(),
}, data);
requestMock.post = sinon.stub();
requestMock.post.onFirstCall().callsArgWith(1, null, {
statusCode: 200
statusCode: 200,
getAllResponseHeaders: sinon.stub(),
});
}

View file

@ -91,6 +91,7 @@ describe("Unit: Controllers", function() {
'e': 'errmsg',
'loading': false
});
w.sizes = sinon.stub().returns({tota:1234});
w.getBalance = sinon.stub().returns(10000);
w.publicKeyRing = sinon.stub().yields(null);
w.publicKeyRing.nicknameForCopayer = sinon.stub().returns('nickcopayer');