UNPKG

ks3-js-sdk

Version:

js sdk for ks3

81 lines (80 loc) 4.07 kB
var characterList = [ '①②③④⑤⑥⑦⑧⑨⑩⑪⑫⑬⑭⑮⑯⑰⑱⑲⑳⓪❶❷❸❹❺❻❼❽❾❿⓫⓬⓭⓮⓯⓰⓱⓲⓳⓴㊀㊁㊂㊃㊄㊅㊆㊇㊈㊉㈠㈡㈢㈣㈤㈥㈦㈧㈨㈩', '⑴⑵⑶⑷⑸⑹⑺⑻⑼⑽⑾⑿⒀⒁⒂⒃⒄⒅⒆⒇⒈⒉⒊⒋⒌⒍⒎⒏⒐⒑⒒⒓⒔⒕⒖⒗⒘⒙⒚⒛ⅠⅡⅢⅣⅤⅥⅦⅧⅨⅩⅪⅫⅰⅱⅲⅳⅴⅵⅶⅷⅸⅹⒶⒷⒸⒹⒺⒻⒼⒽⒾⒿⓀⓁⓂⓃⓄⓅⓆⓇⓈⓉⓊⓋⓌⓍⓎⓏⓐⓑⓒⓓⓔⓕⓖⓗⓘⓙⓚⓛⓜⓝⓞⓟⓠⓡⓢⓣⓤⓥⓦⓧⓨⓩ⒜⒝⒞⒟⒠⒡⒢⒣⒤⒥⒦⒧⒨⒩⒪⒫⒬⒭⒮⒯⒰⒱⒲⒳⒴⒵', '﹢﹣×÷±/=≌∽≦≧≒﹤﹥≈≡≠=≤≥<>≮≯∷∶∫∮∝∞∧∨∑∏∪∩∈∵∴⊥∥∠⌒⊙√∟⊿㏒㏑%', '‰⅟½⅓⅕⅙⅛⅔⅖⅚⅜¾⅗⅝⅞⅘≂≃≄≅≆≇≈≉≊≋≌≍≎≏≐≑≒≓≔≕≖≗≘≙≚≛≜≝≞≟≠≡≢≣≤≥≦≧≨≩⊰⊱⋛⋚∫∬∭∮∯∰∱∲∳%℅‰‱øØπ', '=, +=, -=, *=, /, =, ==, ===, !=, !==, >, <, >=, <=, +, -, *, /, %, &&, ||, !, &, |, ^, ~, <<, >>, >>>', '(), [], {}, "", ;, ?, :, \, #, /* */, ¥, $', '测试中文 ** 特殊符号 && @@ !@#¥%……&*()——+{}|:“《》?【】、;‘’,。、', ]; var specialCharacter = function(item, index) { let isLast = index === characterList.length ? ' 测试集完成,这是最后一个测试用例' : ''; describe('put方法上传文件 ' + index + isLast, function () { let key = 'characterTest/' + item; // 支持上传文件,且上传时必须带上文件类型,如果文件没有类型或者文件为空可以不带 // 支持上传字符串,此时请求头中必须有Content—Type // file可以不填,此时会上传一个空文件 var file = blob({ size: 1024 * 1024 * 5 }); describe('上传文件', function () { it('上传文件,设置归档', function (done) { this.timeout(5000); ks3.putObject({ key, file, acl: 'private', storageClass: 'ARCHIVE', }).then(res => { should.not.exist(res.error); res.statusCode.should.be.equal(200); done(); }) }) it('判断key是否正确' + key, function (done) { this.timeout(2000); ks3.headObject({ key }).then(res => { res.statusCode.should.be.equal(200); done(); }) }) it('获取该文件的ACL', function (done) { this.timeout(2000); ks3.getObjectAcl({ key }).then(res => { let grant = res.body.AccessControlPolicy.AccessControlList.Grant; grant.Permission.should.be.equal('FULL_CONTROL'); should.not.exist(res.error); res.statusCode.should.be.equal(200); done(); }) }) it('解冻该文件', function (done) { this.timeout(2000); ks3.restoreObject({ key }).then(res => { should.not.exist(res.error); res.statusCode.should.be.equal(202); done(); }) }) it('删除该文件', function (done) { this.timeout(2000); ks3.delObject({ key }).then(res => { should.not.exist(res.error); res.statusCode.should.be.equal(204); done(); }) }) }) }) } var specialCharacterTest = function(){ characterList.forEach((element, index) => { specialCharacter(element, index + 1) }); }