Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix ParseClientConfigurationTests.testServerValidation #1837

Closed
4 tasks
dplewis opened this issue Jan 17, 2025 · 4 comments · Fixed by #1844
Closed
4 tasks

fix ParseClientConfigurationTests.testServerValidation #1837

dplewis opened this issue Jan 17, 2025 · 4 comments · Fixed by #1844
Labels
bounty:$10 Bounty applies for fixing this issue (Parse Bounty Program) state:released Released as stable version type:bug Impaired feature or lacking behavior that is likely assumed

Comments

@dplewis
Copy link
Member

dplewis commented Jan 17, 2025

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.");
Copy link

parse-github-assistant bot commented Jan 17, 2025

Thanks for opening this issue!

  • 🚀 You can help us to fix this issue faster by opening a pull request with a failing test. See our Contribution Guide for how to make a pull request, or read our New Contributor's Guide if this is your first time contributing.

@mtrezza mtrezza added the type:ci CI related issue label Jan 17, 2025
@mtrezza
Copy link
Member

mtrezza commented Jan 26, 2025

Is this a bug in the test or a bug in the actual SDK functionality?

@dplewis
Copy link
Member Author

dplewis commented Jan 26, 2025

It’s a bug in the SDK since the server url validation handler doesn’t work properly.

@mtrezza mtrezza added type:bug Impaired feature or lacking behavior that is likely assumed bounty:$10 Bounty applies for fixing this issue (Parse Bounty Program) and removed type:ci CI related issue labels Jan 27, 2025
@parseplatformorg
Copy link
Contributor

🎉 This change has been released in version 5.1.1

@parseplatformorg parseplatformorg added the state:released Released as stable version label Jan 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bounty:$10 Bounty applies for fixing this issue (Parse Bounty Program) state:released Released as stable version type:bug Impaired feature or lacking behavior that is likely assumed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants