-
Notifications
You must be signed in to change notification settings - Fork 0
/
image.js
29 lines (26 loc) · 1.11 KB
/
image.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
var co = require('co');
var should = require('should');
var thunk = require('thunkify');
var UPYUN = require('..');
var fs = require('fs');
var read = thunk(fs.readFile);
var upyun_img = new UPYUN('travis-img', 'travisci', 'testtest', 'ctcc');
describe('Image process', function() {
describe('image upload and process', function(done) {
it('should return pic info when upload file to image bucket', function(done) {
co(function *() {
upyun_img.setConf('bucket', 'travis-img');
upyun_img.setEndpoint('ctcc');
yield upyun_img.downloadFile('/res/upyun_logo.png', './upyun_logo.png');
var res = yield upyun_img.uploadFile('/test/upyun_logo.png', './upyun_logo.png', true, null, {
"x-gmkerl-type": "fix_both",
"x-gmkerl-value": "400x400",
"x-gmkerl-rotate": 90
});
res.should.have.property('data').not.empty;
upyun_img.setConf('bucket', 'travis');
fs.unlinkSync('./upyun_logo.png');
})(done)
})
})
})