Adds testEnqueueBatchOfHTTPRequestOperations.
This commit is contained in:
parent
0fead2b2b9
commit
5c90fd599a
1 changed files with 31 additions and 1 deletions
|
|
@ -86,7 +86,7 @@
|
|||
expect([operation class]).to.equal([AFImageRequestOperation class]);
|
||||
}
|
||||
|
||||
- (void)testEnqueueBatchOfHTTPRequestOperationsWithRequests {
|
||||
- (void)testEnqueueBatchOfHTTPRequestOperations {
|
||||
[Expecta setAsynchronousTestTimeout:5.0];
|
||||
|
||||
__block NSDate *firstCallbackTime = nil;
|
||||
|
|
@ -112,6 +112,36 @@
|
|||
expect(batchCallbackTime).beGreaterThan(firstCallbackTime);
|
||||
}
|
||||
|
||||
- (void)testEnqueueBatchOfHTTPRequestOperationsWithRequests {
|
||||
[Expecta setAsynchronousTestTimeout:5.0];
|
||||
|
||||
[self.client registerHTTPOperationClass:[AFJSONRequestOperation class]];
|
||||
[self.client registerHTTPOperationClass:[AFImageRequestOperation class]];
|
||||
|
||||
__block NSArray *batchOperations = nil;
|
||||
|
||||
NSMutableURLRequest *firstRequest = [self.client requestWithMethod:@"GET" path:@"/" parameters:nil];
|
||||
[firstRequest setValue:@"application/json" forHTTPHeaderField:@"Accept"];
|
||||
|
||||
NSMutableURLRequest *secondeRequest = [self.client requestWithMethod:@"GET" path:@"/" parameters:nil];
|
||||
[secondeRequest setValue:@"image/png" forHTTPHeaderField:@"Accept"];
|
||||
|
||||
[self.client enqueueBatchOfHTTPRequestOperationsWithRequests:@[ firstRequest, secondeRequest ] progressBlock:^(NSUInteger numberOfFinishedOperations, NSUInteger totalNumberOfOperations) {
|
||||
|
||||
} completionBlock:^(NSArray *operations) {
|
||||
batchOperations = operations;
|
||||
}];
|
||||
|
||||
expect(self.client.operationQueue.operationCount).to.equal(@3);
|
||||
expect(batchOperations).willNot.beNil();
|
||||
|
||||
expect(self.client.operationQueue.operationCount).to.equal(@0);
|
||||
expect(batchOperations.count).to.equal(@2);
|
||||
|
||||
expect([[batchOperations objectAtIndex:0] class]).to.equal([AFJSONRequestOperation class]);
|
||||
expect([[batchOperations objectAtIndex:1] class]).to.equal([AFImageRequestOperation class]);
|
||||
}
|
||||
|
||||
- (void)testThatTheDefaultStringEncodingIsUTF8 {
|
||||
expect(self.client.stringEncoding).to.equal(NSUTF8StringEncoding);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue