Skip to content

fix ParseClientConfigurationTests.testServerValidation #1837

Closed
@dplewis

Description

@dplewis

New Issue Checklist

Issue Description

This is a failing test, setting the server url has a check for a valid url that doesn't work in later SDK versions. It should be improved or removed.

Steps to reproduce

- (void)setServer:(NSString *)server {
    PFParameterAssert(server.length, @"Server should not be `nil`.");
    PFParameterAssert([NSURL URLWithString:server], @"Server should be a valid URL.");
    _server = [server copy];
}
- (void)testServerValidation {
    [ParseClientConfiguration configurationWithBlock:^(id<ParseMutableClientConfiguration>  _Nonnull configuration) {
        configuration.applicationId = @"a";
        configuration.clientKey = @"b";

        PFAssertThrowsInvalidArgumentException(configuration.server = @"");
        PFAssertThrowsInvalidArgumentException(configuration.server = @"Yolo Yarr"); // fails
    }];
}
[NSURL URLWithString:@"Yolo Yarr"] // this is valid as URLWithString encodes the url instead of throwing an error in later SDK versions.
// Yolo%20Yarr

Solution

Try this, something similar or remove the check entirely

NSURL *url = [NSURL URLWithString:server];
PFParameterAssert(url && url.scheme && url.host, @"Server should be a valid URL.");

Metadata

Metadata

Assignees

No one assigned

    Labels

    bounty:$10Bounty applies for fixing this issue (Parse Bounty Program)state:releasedReleased as stable versiontype:bugImpaired feature or lacking behavior that is likely assumed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions