Toggle navigation
Toggle navigation
This project
Loading...
Sign in
iOS
/
asi-http-request
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
Ben Copsey
2010-09-19 14:06:09 +0100
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
484c59780c16466022d5b99145057135c9e313c8
484c5978
1 parent
4508fdd7
Added basic santity check test for S3 over https
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
44 additions
and
0 deletions
Classes/Tests/ASIS3RequestTests.h
Classes/Tests/ASIS3RequestTests.m
Classes/Tests/ASIS3RequestTests.h
View file @
484c597
...
...
@@ -21,6 +21,8 @@
-
(
void
)
testListRequest
;
-
(
void
)
testSubclasses
;
-
(
void
)
createTestBucket
;
-
(
void
)
testCopy
;
-
(
void
)
testHTTPS
;
@property
(
retain
,
nonatomic
)
ASINetworkQueue
*
networkQueue
;
@end
...
...
Classes/Tests/ASIS3RequestTests.m
View file @
484c597
...
...
@@ -757,6 +757,48 @@ static NSString *bucket = @"";
}
-
(
void
)
testHTTPS
{
[
ASIS3Request
setSharedAccessKey
:
accessKey
];
[
ASIS3Request
setSharedSecretAccessKey
:
secretAccessKey
];
// Create a bucket
ASIS3Request
*
request
=
[
ASIS3BucketRequest
PUTRequestWithBucket
:
bucket
];
[
request
setRequestScheme
:
ASIS3RequestSchemeHTTPS
];
[
request
startSynchronous
];
GHAssertNil
([
request
error
],
@"Failed to create a bucket"
);
// PUT something in it
NSString
*
key
=
@"king"
;
request
=
[
ASIS3ObjectRequest
PUTRequestForData
:[
@"fink"
dataUsingEncoding
:
NSUTF8StringEncoding
]
withBucket
:
bucket
key
:
key
];
[
request
setRequestScheme
:
ASIS3RequestSchemeHTTPS
];
[
request
startSynchronous
];
BOOL
success
=
[[
request
responseString
]
isEqualToString
:
@""
];
GHAssertTrue
(
success
,
@"Failed to PUT some data into S3"
);
// GET it
request
=
[
ASIS3ObjectRequest
requestWithBucket
:
bucket
key
:
key
];
[
request
setRequestScheme
:
ASIS3RequestSchemeHTTPS
];
[
request
startSynchronous
];
success
=
[[
request
responseString
]
isEqualToString
:
@"fink"
];
GHAssertTrue
(
success
,
@"Failed to GET the correct data from S3"
);
// DELETE it
request
=
[
ASIS3ObjectRequest
DELETERequestWithBucket
:
bucket
key
:
@"king"
];
[
request
startSynchronous
];
success
=
[[
request
responseString
]
isEqualToString
:
@""
];
GHAssertTrue
(
success
,
@"Failed to DELETE the copy from S3"
);
// Delete the bucket
request
=
[
ASIS3BucketRequest
DELETERequestWithBucket
:
bucket
];
[
request
setRequestScheme
:
ASIS3RequestSchemeHTTPS
];
[
request
startSynchronous
];
GHAssertNil
([
request
error
],
@"Failed to delete a bucket"
);
[
ASIS3Request
setSharedAccessKey
:
nil
];
[
ASIS3Request
setSharedSecretAccessKey
:
nil
];
}
@synthesize
networkQueue
;
...
...
Please
register
or
login
to post a comment