Details
-
Bug
-
Status: Closed
-
Critical
-
Resolution: Fixed
-
None
-
Xcode 4
Description
Theses tests fail with version 1.2.0 (not tested before) :
PGWhitelistTests.h
@interface PGWhitelistTests : SenTestCase {
}
PGWhitelistTests.m
#import "PGWhitelistTests.h" #import <PhoneGap/PGWhitelist.h> @implementation PGWhitelistTests - (void)setUp { [super setUp]; } - (void)tearDown { [super tearDown]; } - (void) testIpExactMatch { NSArray* allowedHosts = [NSArray arrayWithObjects: @"162.168.1.1", @"162.168.2.1", nil]; PGWhitelist* whitelist = [[PGWhitelist alloc] initWithArray:allowedHosts]; STAssertFalse([whitelist URLIsAllowed:[NSURL URLWithString:@"http://mydomain.com"]], nil); STAssertTrue([whitelist URLIsAllowed:[NSURL URLWithString:@"http://192.168.1.1"]], nil); STAssertTrue([whitelist URLIsAllowed:[NSURL URLWithString:@"http://192.168.2.1"]], nil); STAssertFalse([whitelist URLIsAllowed:[NSURL URLWithString:@"http://192.168.3.1"]], nil); [whitelist release]; } - (void) testIpWildcardMatch { NSArray* allowedHosts = [NSArray arrayWithObjects: @"162.168.1.*", @"162.168.2.*", nil]; PGWhitelist* whitelist = [[PGWhitelist alloc] initWithArray:allowedHosts]; STAssertFalse([whitelist URLIsAllowed:[NSURL URLWithString:@"http://mydomain.com"]], nil); STAssertTrue([whitelist URLIsAllowed:[NSURL URLWithString:@"http://192.168.1.1"]], nil); STAssertTrue([whitelist URLIsAllowed:[NSURL URLWithString:@"http://192.168.1.2"]], nil); STAssertTrue([whitelist URLIsAllowed:[NSURL URLWithString:@"http://192.168.2.1"]], nil); STAssertTrue([whitelist URLIsAllowed:[NSURL URLWithString:@"http://192.168.2.2"]], nil); STAssertFalse([whitelist URLIsAllowed:[NSURL URLWithString:@"http://192.168.3.1"]], nil); [whitelist release]; } @end