incubator-callback-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Shazron Abdullah (Commented) (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CB-96) [PGWhitelist processWhitelist] IP adresses handling
Date Wed, 30 Nov 2011 19:25:40 GMT

    [ https://issues.apache.org/jira/browse/CB-96?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13160262#comment-13160262
] 

Shazron Abdullah commented on CB-96:
------------------------------------

I'll add those tests to our tests and fix.
                
> [PGWhitelist processWhitelist] IP adresses handling
> ---------------------------------------------------
>
>                 Key: CB-96
>                 URL: https://issues.apache.org/jira/browse/CB-96
>             Project: Apache Callback
>          Issue Type: Bug
>          Components: iOS
>         Environment: Xcode 4
>            Reporter: STB Land
>            Assignee: Shazron Abdullah
>              Labels: objective-c, phonegap, regex, wildcard
>   Original Estimate: 4h
>  Remaining Estimate: 4h
>
> Theses tests fail with version 1.2.0 (not tested before) :
> {code:title=PGWhitelistTests.h|borderStyle=solid}
> @interface PGWhitelistTests : SenTestCase {
> }
> {code}
> {code:title=PGWhitelistTests.m|borderStyle=solid}
> #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
> {code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message