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: Parse.server doesn't return server url #1821

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

dplewis
Copy link
Member

@dplewis dplewis commented Oct 31, 2024

New Pull Request Checklist

Issue Description

ParseClientConfiguration *config is never used, when the current parse manager isn't set no url is returned.

Approach

  • Get server URL from proper configuration

Copy link

parse-github-assistant bot commented Oct 31, 2024

Thanks for opening this pull request!

  • ❌ Please link an issue that describes the reason for this pull request, otherwise your pull request will be closed. Make sure to write it as Closes: #123 in the PR description, so I can recognize it.

@dplewis dplewis requested a review from a team October 31, 2024 16:46
@dplewis dplewis changed the title fix: Parse.server doesn't return server url fix: Parse.server doesn't return server url Oct 31, 2024
@mtrezza
Copy link
Member

mtrezza commented Oct 31, 2024

The SDK has a feature where the server URL can be changed on the fly, after Parse SDK init. Could this have any impact on that feature? I'm not sure we have a test for this?

#729
#1464

@dplewis
Copy link
Member Author

dplewis commented Oct 31, 2024

Doesn't have any impact on that feature

Copy link
Member

@mtrezza mtrezza left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And could you add a test for this fix?

Copy link

codecov bot commented Oct 31, 2024

Codecov Report

Attention: Patch coverage is 0% with 1 line in your changes missing coverage. Please review.

Project coverage is 82.79%. Comparing base (dd05d41) to head (b8966d0).
Report is 29 commits behind head on master.

Files with missing lines Patch % Lines
Parse/Parse/Source/Parse.m 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           master    #1821       +/-   ##
===========================================
+ Coverage   64.24%   82.79%   +18.55%     
===========================================
  Files         201      282       +81     
  Lines       23233    30726     +7493     
===========================================
+ Hits        14926    25440    +10514     
+ Misses       8307     5286     -3021     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@dplewis
Copy link
Member Author

dplewis commented Nov 1, 2024

@mtrezza I don't think setServer works. There are two or more configurations being managed. There are no tests for this but I wrote one.

- (void)testSetServerURL {
    ParseClientConfiguration *configuration = [ParseClientConfiguration configurationWithBlock:^(id<ParseMutableClientConfiguration> configuration) {
        configuration.applicationId = @"foo";
        configuration.clientKey = @"bar";
        configuration.server = @"http://localhost";
        configuration.localDatastoreEnabled = YES;
        configuration.networkRetryAttempts = 1337;
    }];

    XCTAssertEqualObjects(configuration.applicationId, @"foo");
    XCTAssertEqualObjects(configuration.clientKey, @"bar");
    XCTAssertTrue(configuration.localDatastoreEnabled);
    XCTAssertEqual(configuration.networkRetryAttempts, 1337);
    XCTAssertEqualObjects(configuration.server, @"http://localhost");

    NSLog(@"%@", Parse.server); // https://api.parse.com/1 ???

    [Parse setServer:@"http://example.org"]; // Error: You must set your configuration's `applicationId` before calling +[Parse initializeWithConfigurationAllowingReinitialize:]! (NSInternalInconsistencyException)
}

@mtrezza
Copy link
Member

mtrezza commented Nov 1, 2024

Parse.setServer should work, the client needs to be initialized. This is for setting the server on the fly, not for setting the config in preparation for SDK init. Thanks for adding a test though, I was actually referring to a test for the changed line in this PR, but if we have a test for setServer as well, even better.

@dplewis
Copy link
Member Author

dplewis commented Nov 1, 2024

@mtrezza Can you add a test case for setServer? I saw your last PR #1708 but no test cases was added. I may have missed something. Just copy my test and add it to ParseClientConfigurationTests with #import "Parse_Private.h" at the top

@mtrezza
Copy link
Member

mtrezza commented Nov 1, 2024

Unfortunately I'm lacking the toolchain at the moment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants