Skip to content

Commit 7e639f8

Browse files
author
karisli
committed
UI修复
1 parent 013836c commit 7e639f8

File tree

6 files changed

+274
-407
lines changed

6 files changed

+274
-407
lines changed

QCloudCOSXMLDemoTests/QCloudCOSTransferTests.m

Lines changed: 187 additions & 80 deletions
Large diffs are not rendered by default.

QCloudCOSXMLDemoTests/QCloudCOSXMLBucketTests.m

Lines changed: 32 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@
1717
#import "QCloudTestTempVariables.h"
1818
#import "QCloudCOSXMLTestUtility.h"
1919
#import "SecretStorage.h"
20+
#define kCOSTestBucketKey @"bucket"
2021
@interface QCloudCOSXMLBucketTests : XCTestCase <QCloudSignatureProvider>
21-
@property (nonatomic, strong) NSString *bucket;
2222
@property (nonatomic, strong) NSString *authorizedUIN;
2323
@property (nonatomic, strong) NSString *ownerUIN;
2424
@property (nonatomic, strong) NSString *appID;
2525
@end
26-
26+
static QCloudBucket *cosxmlTestBucket;
2727
@implementation QCloudCOSXMLBucketTests
2828

2929
- (void)signatureWithFields:(QCloudSignatureFields *)fileds
@@ -52,17 +52,16 @@ - (void)setupSpecialCOSXMLShareService {
5252
}
5353

5454
+ (void)setUp {
55-
[QCloudTestTempVariables sharedInstance].testBucket = [[QCloudCOSXMLTestUtility sharedInstance] createTestBucketWithPrefix:@"bt"];
55+
cosxmlTestBucket = [[QCloudCOSXMLTestUtility sharedInstance] createTestBucketWithPrefix:kCOSTestBucketKey];
5656
}
5757

5858
+ (void)tearDown {
59-
[[QCloudCOSXMLTestUtility sharedInstance] deleteAllTestBuckets];
59+
[[QCloudCOSXMLTestUtility sharedInstance] deleteTestBucket:cosxmlTestBucket];
6060
}
6161

6262
- (void)setUp {
6363
[super setUp];
6464
[self setupSpecialCOSXMLShareService];
65-
self.bucket = [QCloudTestTempVariables sharedInstance].testBucket;
6665
self.appID = kAppID;
6766
self.authorizedUIN = @"1131975903";
6867
self.ownerUIN = @"1278687956";
@@ -77,7 +76,7 @@ - (void)createTestBucket {
7776
__weak typeof(self) weakSelf = self;
7877
[request setFinishBlock:^(id outputObject, NSError *error) {
7978
XCTAssertNil(error);
80-
self.bucket = bucketName;
79+
cosxmlTestBucket.name = bucketName;
8180
[QCloudTestTempVariables sharedInstance].testBucket = bucketName;
8281
responseError = error;
8382
[exception fulfill];
@@ -88,7 +87,7 @@ - (void)createTestBucket {
8887

8988
- (void)tearDown {
9089
// Put teardown code here. This method is called after the invocation of each test method in the class.
91-
// [[QCloudCOSXMLTestUtility sharedInstance] deleteTestBucket:self.bucket];
90+
// [[QCloudCOSXMLTestUtility sharedInstance] deleteTestBucket:cosxmlTestBucket.name];
9291
[super tearDown];
9392
}
9493

@@ -178,7 +177,7 @@ - (void)testMoreRegion {
178177

179178
- (void)testGetBucket {
180179
QCloudGetBucketRequest *request = [QCloudGetBucketRequest new];
181-
request.bucket = self.bucket;
180+
request.bucket = cosxmlTestBucket.name;
182181
request.maxKeys = 1000;
183182
request.prefix = @"0";
184183
request.delimiter = @"0";
@@ -198,7 +197,7 @@ - (void)testGetBucket {
198197

199198
XCTAssertNotNil(listResult);
200199
NSString *listResultName = listResult.name;
201-
NSString *expectListResultName = [NSString stringWithFormat:@"%@-%@", self.bucket, self.appID];
200+
NSString *expectListResultName = [NSString stringWithFormat:@"%@-%@", cosxmlTestBucket.name, self.appID];
202201
XCTAssert([listResultName isEqualToString:expectListResultName]);
203202
}
204203

@@ -217,7 +216,7 @@ - (void)testCORS1_PutBucketCORS {
217216
cors.rules = @[ rule ];
218217

219218
putCORS.corsConfiguration = cors;
220-
putCORS.bucket = self.bucket;
219+
putCORS.bucket = cosxmlTestBucket.name;
221220
__block NSError *localError;
222221
XCTestExpectation *exp = [self expectationWithDescription:@"putacl"];
223222
[putCORS setFinishBlock:^(id outputObject, NSError *error) {
@@ -244,15 +243,15 @@ - (void)testCORS1_PutBucketCORS {
244243
// putCors.rules = @[ rule ];
245244
//
246245
// putCORS.corsConfiguration = putCors;
247-
// putCORS.bucket = self.bucket;
246+
// putCORS.bucket = cosxmlTestBucket.name;
248247
// __block NSError *localError1;
249248
//
250249
// __block QCloudCORSConfiguration *cors;
251250
// __block XCTestExpectation *exp = [self expectationWithDescription:@"delete"];
252251
//
253252
// [putCORS setFinishBlock:^(id outputObject, NSError *error) {
254253
// QCloudGetBucketCORSRequest *corsReqeust = [QCloudGetBucketCORSRequest new];
255-
// corsReqeust.bucket = self.bucket;
254+
// corsReqeust.bucket = cosxmlTestBucket.name;
256255
//
257256
// [corsReqeust setFinishBlock:^(QCloudCORSConfiguration *_Nonnull result, NSError *_Nonnull error) {
258257
// XCTAssertNil(error);
@@ -279,11 +278,11 @@ - (void)testCORS1_PutBucketCORS {
279278

280279
- (void)testCORS3_OpetionObject {
281280
QCloudOptionsObjectRequest *request = [[QCloudOptionsObjectRequest alloc] init];
282-
request.bucket = self.bucket;
281+
request.bucket = cosxmlTestBucket.name;
283282
request.origin = @"http://www.qcloud.com";
284283
request.accessControlRequestMethod = @"GET";
285284
request.accessControlRequestHeaders = @"origin";
286-
request.object = [[QCloudCOSXMLTestUtility sharedInstance] uploadTempObjectInBucket:self.bucket];
285+
request.object = [[QCloudCOSXMLTestUtility sharedInstance] uploadTempObjectInBucket:cosxmlTestBucket.name];
287286
XCTestExpectation *exp = [self expectationWithDescription:@"option object"];
288287

289288
__block id resultError;
@@ -303,7 +302,7 @@ - (void)testCORS3_OpetionObject {
303302

304303
- (void)testCORS4_DeleteBucketCORS {
305304
QCloudDeleteBucketCORSRequest *deleteCORS = [QCloudDeleteBucketCORSRequest new];
306-
deleteCORS.bucket = self.bucket;
305+
deleteCORS.bucket = cosxmlTestBucket.name;
307306

308307
NSLog(@"test");
309308

@@ -324,7 +323,7 @@ - (void)testCORS4_DeleteBucketCORS {
324323

325324
- (void)testGetBucketLocation {
326325
QCloudGetBucketLocationRequest *locationReq = [QCloudGetBucketLocationRequest new];
327-
locationReq.bucket = self.bucket;
326+
locationReq.bucket = cosxmlTestBucket.name;
328327
XCTestExpectation *exp = [self expectationWithDescription:@"delete"];
329328
__block QCloudBucketLocationConstraint *location;
330329

@@ -381,13 +380,13 @@ - (void)testPut_And_Get_BucketACL {
381380

382381
[ACLGrants addObject:g1];
383382
[ACLGrants addObject:g2];
384-
putACL.bucket = self.bucket;
383+
putACL.bucket = cosxmlTestBucket.name;
385384
XCTestExpectation *exp = [self expectationWithDescription:@"putacl"];
386385
__block NSError *localError;
387386
[putACL setFinishBlock:^(id outputObject, NSError *error) {
388387
XCTAssertNil(error);
389388
QCloudGetBucketACLRequest *getBucketACLRequest = [[QCloudGetBucketACLRequest alloc] init];
390-
getBucketACLRequest.bucket = self.bucket;
389+
getBucketACLRequest.bucket = cosxmlTestBucket.name;
391390
[getBucketACLRequest setFinishBlock:^(QCloudACLPolicy *result, NSError *error) {
392391
XCTAssertNil(error);
393392
XCTAssertNotNil(result);
@@ -404,7 +403,7 @@ - (void)testPut_And_Get_BucketACL {
404403

405404
- (void)testHeadBucket {
406405
QCloudHeadBucketRequest *request = [QCloudHeadBucketRequest new];
407-
request.bucket = self.bucket;
406+
request.bucket = cosxmlTestBucket.name;
408407
XCTestExpectation *exp = [self expectationWithDescription:@"putacl"];
409408
__block NSError *resultError;
410409
[request setFinishBlock:^(id outputObject, NSError *error) {
@@ -419,7 +418,7 @@ - (void)testHeadBucket {
419418
- (void)testListMultipartUpload {
420419
dispatch_semaphore_t semaphore = dispatch_semaphore_create(0);
421420
QCloudCOSXMLUploadObjectRequest *uploadObjectRequest = [[QCloudCOSXMLUploadObjectRequest alloc] init];
422-
uploadObjectRequest.bucket = self.bucket;
421+
uploadObjectRequest.bucket = cosxmlTestBucket.name;
423422
uploadObjectRequest.object = @"object-aborted";
424423
uploadObjectRequest.body = [NSURL URLWithString:[QCloudTestUtility tempFileWithSize:5 unit:QCLOUD_TEST_FILE_UNIT_MB]];
425424
__weak QCloudCOSXMLUploadObjectRequest *weakRequest = uploadObjectRequest;
@@ -440,7 +439,7 @@ - (void)testListMultipartUpload {
440439
dispatch_semaphore_wait(semaphore, DISPATCH_TIME_FOREVER);
441440

442441
QCloudListMultipartRequest *request = [[QCloudListMultipartRequest alloc] init];
443-
request.bucket = self.bucket;
442+
request.bucket = cosxmlTestBucket.name;
444443
request.object = uploadObjectRequest.object;
445444
request.uploadId = uploadID;
446445

@@ -456,7 +455,7 @@ - (void)testListMultipartUpload {
456455

457456
- (void)testListBucketUploads {
458457
QCloudListBucketMultipartUploadsRequest *uploads = [QCloudListBucketMultipartUploadsRequest new];
459-
uploads.bucket = self.bucket;
458+
uploads.bucket = cosxmlTestBucket.name;
460459
uploads.maxUploads = 1000;
461460
__block NSError *localError;
462461
__block QCloudListMultipartUploadsResult *multiPartUploadsResult;
@@ -471,7 +470,7 @@ - (void)testListBucketUploads {
471470

472471
XCTAssertNil(localError);
473472
XCTAssert(multiPartUploadsResult.maxUploads == 1000);
474-
NSString *expectedBucketString = [NSString stringWithFormat:@"%@-%@", self.bucket, self.appID];
473+
NSString *expectedBucketString = [NSString stringWithFormat:@"%@-%@", cosxmlTestBucket.name, self.appID];
475474
XCTAssert([multiPartUploadsResult.bucket isEqualToString:expectedBucketString]);
476475
XCTAssert(multiPartUploadsResult.maxUploads == 1000);
477476
if (multiPartUploadsResult.uploads.count) {
@@ -485,7 +484,7 @@ - (void)testListBucketUploads {
485484

486485
- (void)testaPut_Get_Delete_BucketLifeCycle {
487486
QCloudPutBucketLifecycleRequest *request = [QCloudPutBucketLifecycleRequest new];
488-
request.bucket = self.bucket;
487+
request.bucket = cosxmlTestBucket.name;
489488
__block QCloudLifecycleConfiguration *configuration = [[QCloudLifecycleConfiguration alloc] init];
490489
QCloudLifecycleRule *rule = [[QCloudLifecycleRule alloc] init];
491490
rule.identifier = @"id1";
@@ -507,7 +506,7 @@ - (void)testaPut_Get_Delete_BucketLifeCycle {
507506
XCTAssertNil(putLifecycleError);
508507

509508
QCloudGetBucketLifecycleRequest *request = [QCloudGetBucketLifecycleRequest new];
510-
request.bucket = self.bucket;
509+
request.bucket = cosxmlTestBucket.name;
511510
[request setFinishBlock:^(QCloudLifecycleConfiguration *getLifecycleReuslt, NSError *getLifeCycleError) {
512511
XCTAssertNil(getLifeCycleError);
513512
XCTAssertNotNil(getLifecycleReuslt);
@@ -517,7 +516,7 @@ - (void)testaPut_Get_Delete_BucketLifeCycle {
517516

518517
// delete configuration
519518
QCloudDeleteBucketLifeCycleRequest *request = [[QCloudDeleteBucketLifeCycleRequest alloc] init];
520-
request.bucket = self.bucket;
519+
request.bucket = cosxmlTestBucket.name;
521520
[request setFinishBlock:^(QCloudLifecycleConfiguration *deleteResult, NSError *deleteError) {
522521
XCTAssert(deleteResult);
523522
XCTAssertNil(deleteError);
@@ -544,7 +543,7 @@ - (void)testPut_And_Get_BucketVersioning {
544543
XCTAssertNil(error);
545544

546545
QCloudGetBucketVersioningRequest *request = [[QCloudGetBucketVersioningRequest alloc] init];
547-
request.bucket = self.bucket;
546+
request.bucket = cosxmlTestBucket.name;
548547
[request setFinishBlock:^(QCloudBucketVersioningConfiguration *result, NSError *error) {
549548
XCTAssert(result);
550549
XCTAssertNil(error);
@@ -557,7 +556,7 @@ - (void)testPut_And_Get_BucketVersioning {
557556

558557
//
559558
QCloudPutBucketVersioningRequest *suspendRequest = [[QCloudPutBucketVersioningRequest alloc] init];
560-
suspendRequest.bucket = self.bucket;
559+
suspendRequest.bucket = cosxmlTestBucket.name;
561560
QCloudBucketVersioningConfiguration *suspendConfiguration = [[QCloudBucketVersioningConfiguration alloc] init];
562561
request.configuration = suspendConfiguration;
563562
suspendConfiguration.status = QCloudCOSBucketVersioningStatusSuspended;
@@ -647,7 +646,7 @@ - (void)testPut_Get_Delte_BucketReplication {
647646
// // Then enable replication for source bucket;
648647
// XCTestExpectation* putReplicationExpectation = [self expectationWithDescription:@"put replication expectation"];
649648
// QCloudPutBucketReplicationRequest* putBucketReplicationRequest = [[QCloudPutBucketReplicationRequest alloc] init];
650-
// putBucketReplicationRequest.bucket = self.bucket;
649+
// putBucketReplicationRequest.bucket = cosxmlTestBucket.name;
651650
// QCloudBucketReplicationConfiguation* putReplicationConfiguration = [[QCloudBucketReplicationConfiguation alloc] init];
652651
// putBucketReplicationRequest.configuation = putReplicationConfiguration;
653652
// putReplicationConfiguration.status = QCloudCOSBucketVersioningStatusEnabled;
@@ -957,14 +956,14 @@ - (void)testPUT_GETBucketDomain {
957956
- (void)testPUT_GETBucketAccelerate {
958957
XCTestExpectation *expectation = [self expectationWithDescription:@"Put Object Copy"];
959958
QCloudPutBucketAccelerateRequest *req = [QCloudPutBucketAccelerateRequest new];
960-
req.bucket = self.bucket;
959+
req.bucket = cosxmlTestBucket.name;
961960
QCloudBucketAccelerateConfiguration *config = [QCloudBucketAccelerateConfiguration new];
962961
config.status = QCloudCOSBucketAccelerateStatusEnabled;
963962
req.configuration = config;
964963
[req setFinishBlock:^(id _Nullable outputObject, NSError *_Nullable error) {
965964
if (!error) {
966965
QCloudGetBucketAccelerateRequest *get = [QCloudGetBucketAccelerateRequest new];
967-
get.bucket = self.bucket;
966+
get.bucket = cosxmlTestBucket.name;
968967
[get setFinishBlock:^(QCloudBucketAccelerateConfiguration *_Nullable result, NSError *_Nullable error) {
969968
XCTAssertNil(error);
970969
[expectation fulfill];
@@ -982,7 +981,7 @@ - (void)testPUT_GETBucketAccelerate {
982981
- (void)testPUT_GETBucketIntelligentTiering {
983982
XCTestExpectation *exp = [self expectationWithDescription:@"IntelligentTiering"];
984983
QCloudPutBucketIntelligentTieringRequest *put = [QCloudPutBucketIntelligentTieringRequest new];
985-
put.bucket = self.bucket;
984+
put.bucket = cosxmlTestBucket.name;
986985
QCloudIntelligentTieringConfiguration *config = [QCloudIntelligentTieringConfiguration new];
987986
config.status = QCloudintelligentTieringStatusEnabled;
988987
QCloudIntelligentTieringTransition *transition = [QCloudIntelligentTieringTransition new];
@@ -993,7 +992,7 @@ - (void)testPUT_GETBucketIntelligentTiering {
993992
XCTAssertNil(error);
994993
if (!error) {
995994
QCloudGetBucketIntelligentTieringRequest *get = [QCloudGetBucketIntelligentTieringRequest new];
996-
get.bucket = self.bucket;
995+
get.bucket = cosxmlTestBucket.name;
997996
[get setFinishBlock:^(QCloudIntelligentTieringConfiguration *_Nonnull result, NSError *_Nonnull error) {
998997
XCTAssertNil(error);
999998
XCTAssertEqual(result.status, QCloudintelligentTieringStatusEnabled);

0 commit comments

Comments
 (0)