mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-09-14 22:51:28 +00:00
Test: Expand Unit tests for CPURLConnection
These tests cover new methods added to CPURLConnection
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
@import <OJUnit/OJTestCase.j>
|
||||
|
||||
@implementation CPURLConnectionTest : OJTestCase
|
||||
{
|
||||
@@ -36,4 +37,40 @@
|
||||
[self assertNull:data];
|
||||
}
|
||||
|
||||
- (void)testClassMethodConnectionWithCredentials
|
||||
{
|
||||
var req = [CPURLRequest requestWithURL:[CPURL URLWithString:@"Tests/Foundation/CPURLConnectionTest.j"]];
|
||||
[req setWithCredentials:YES];
|
||||
var data = [CPURLConnection sendSynchronousRequest:req returningResponse:nil];
|
||||
|
||||
[self assertNotNull:data];
|
||||
}
|
||||
|
||||
- (void)testInstanceMethodConnectionWithCredentials
|
||||
{
|
||||
var req = [CPURLRequest requestWithURL:[CPURL URLWithString:@"Tests/Foundation/CPURLConnectionTest.j"]];
|
||||
[req setWithCredentials:YES];
|
||||
|
||||
var conn = [[CPURLConnection alloc] initWithRequest:req delegate:nil startImmediately:NO];
|
||||
|
||||
[self assertTrue:conn._HTTPRequest.withCredentials];
|
||||
|
||||
[req setWithCredentials:NO];
|
||||
[self assertTrue:conn._HTTPRequest.withCredentials];
|
||||
}
|
||||
|
||||
- (void)testRequestGetters
|
||||
{
|
||||
var req = [CPURLRequest requestWithURL:[CPURL URLWithString:@"Tests/Foundation/CPURLConnectionTest.j"]],
|
||||
conn = [[CPURLConnection alloc] initWithRequest:req delegate:nil startImmediately:NO];
|
||||
|
||||
var originalRequest = [conn originalRequest],
|
||||
currentRequest = [conn currentRequest];
|
||||
|
||||
[self assert:originalRequest._UID notEqual:currentRequest._UID];
|
||||
|
||||
[[conn currentRequest] setWithCredentials:YES];
|
||||
[self assert:[originalRequest withCredentials] notEqual:[currentRequest withCredentials]];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
Reference in New Issue
Block a user