-
Notifications
You must be signed in to change notification settings - Fork 189
Refactor some code & add some test cases #350
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
测试有一处没过,可以修改一下
部分改动缩小代码量,通用型更强
test/rs.test.js
Outdated
it('test privateDownloadUrl', function (done) { | ||
var key = 'qiniu.mp4'; | ||
var url = bucketManager.privateDownloadUrl('http://' + domain, key, 20); | ||
should.equal(url, 'http://' + domain + '/qiniu.mp4?e=20&token=ExAdnmHq914NVa8addkXooUvXSyzGPHYzxzJwDnN:vZRvLfuw4U9vJzweTVgPdPFIY-g='); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
建议代码生成鉴权downloadUrl
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里改成了下载请求
should.not.exist(err); | ||
console.log(JSON.stringify(respBody) + '\n'); | ||
console.log(JSON.stringify(respInfo)); | ||
respBody.should.have.keys('item'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
接口没问题,test过不了
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个接口不应该返回列表么?我测试时返回的是单个对象
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
数据问题,暂时不关注,可以看看examples/rs_listv2.js的注释
@@ -134,3 +135,32 @@ exports.isQiniuCallback = function (mac, requestURI, reqBody, callbackAuth) { | |||
var auth = exports.generateAccessToken(mac, requestURI, reqBody); | |||
return auth === callbackAuth; | |||
}; | |||
|
|||
exports.prepareZone = function (ctx, accessKey, bucket, callback) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Best pr
Thanks for the PR |
Math.ceil
nyc
useCache
refactor