-
-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Only encode email on ParseUser if different from Keychain (#256)
* Failing test cases * Compare email update to Keychain on Apple devices * Check Keychain for container instead of User
- Loading branch information
Showing
6 changed files
with
67 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ coverage: | |
status: | ||
patch: | ||
default: | ||
target: 0 | ||
target: auto | ||
changes: false | ||
project: | ||
default: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -542,6 +542,46 @@ class ParseUserTests: XCTestCase { // swiftlint:disable:this type_body_length | |
XCTAssertEqual(command.body?.email, email) | ||
} | ||
|
||
#if !os(Linux) && !os(Android) | ||
func testUpdateCommandCurrentUserModifiedEmail() throws { | ||
try userSignUp() | ||
guard let user = User.current, | ||
let objectId = user.objectId else { | ||
XCTFail("Should have current user.") | ||
return | ||
} | ||
let email = "[email protected]" | ||
User.current?.email = email | ||
XCTAssertNotNil(User.current?.email) | ||
let command = try User.current?.saveCommand() | ||
XCTAssertNotNil(command) | ||
XCTAssertEqual(command?.path.urlComponent, "/users/\(objectId)") | ||
XCTAssertEqual(command?.method, API.Method.PUT) | ||
XCTAssertNil(command?.params) | ||
XCTAssertNotNil(command?.body) | ||
XCTAssertEqual(command?.body?.email, email) | ||
} | ||
|
||
func testUpdateCommandCurrentUserNotCurrentModifiedEmail() throws { | ||
try userSignUp() | ||
guard let user = User.current, | ||
let objectId = user.objectId else { | ||
XCTFail("Should have current user.") | ||
return | ||
} | ||
let email = "[email protected]" | ||
User.current?.email = email | ||
XCTAssertNotNil(User.current?.email) | ||
let command = try User.current?.saveCommand() | ||
XCTAssertNotNil(command) | ||
XCTAssertEqual(command?.path.urlComponent, "/users/\(objectId)") | ||
XCTAssertEqual(command?.method, API.Method.PUT) | ||
XCTAssertNil(command?.params) | ||
XCTAssertNotNil(command?.body) | ||
XCTAssertEqual(command?.body?.email, email) | ||
} | ||
#endif | ||
|
||
func testSaveAndUpdateCurrentUser() throws { // swiftlint:disable:this function_body_length | ||
XCTAssertNil(User.current?.objectId) | ||
try userSignUp() | ||
|