-
Notifications
You must be signed in to change notification settings - Fork 130
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #505 from bugsnag/v6-user
Rename setUser/user interface on Bugsnag and BugsnagConfiguration
- Loading branch information
Showing
17 changed files
with
83 additions
and
57 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
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
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 |
---|---|---|
|
@@ -388,7 +388,7 @@ - (void)testUserPersistence { | |
// XCTAssertNil([bsg_SSKeychain passwordForService:kBugsnagUserUserId account:kBugsnagUserKeychainAccount]); | ||
|
||
// user should be persisted by default | ||
[config setUser:userId withName:name andEmail:email]; | ||
[config setUser:userId withEmail:email andName:name]; | ||
|
||
// Check values manually | ||
// XCTAssertEqualObjects([bsg_SSKeychain passwordForService:kBugsnagUserEmailAddress account:kBugsnagUserKeychainAccount], email); | ||
|
@@ -423,7 +423,10 @@ - (void)testUserNonPesistence { | |
// XCTAssertNil([bsg_SSKeychain passwordForService:kBugsnagUserUserId account:kBugsnagUserKeychainAccount]); | ||
|
||
BugsnagConfiguration *config2 = [[BugsnagConfiguration alloc] initWithApiKey:DUMMY_APIKEY_32CHAR_1]; | ||
XCTAssertNil(config2.currentUser); | ||
XCTAssertNotNil(config2.user); | ||
XCTAssertNil(config2.user.userId); | ||
XCTAssertNil(config2.user.name); | ||
XCTAssertNil(config2.user.emailAddress); | ||
} | ||
|
||
/** | ||
|
@@ -443,16 +446,16 @@ - (void)testPartialPesistence { | |
// XCTAssertNil([bsg_SSKeychain passwordForService:kBugsnagUserName account:kBugsnagUserKeychainAccount]); | ||
// XCTAssertNil([bsg_SSKeychain passwordForService:kBugsnagUserUserId account:kBugsnagUserKeychainAccount]); | ||
|
||
[config setUser:userId withName:nil andEmail:nil]; | ||
[config setUser:userId withEmail:nil andName:nil]; | ||
// XCTAssertNil([bsg_SSKeychain passwordForService:kBugsnagUserEmailAddress account:kBugsnagUserKeychainAccount]); | ||
// XCTAssertNil([bsg_SSKeychain passwordForService:kBugsnagUserName account:kBugsnagUserKeychainAccount]); | ||
// XCTAssertEqualObjects([bsg_SSKeychain passwordForService:kBugsnagUserUserId account:kBugsnagUserKeychainAccount], userId); | ||
[config setUser:nil withName:name andEmail:nil]; | ||
[config setUser:nil withEmail:email andName:nil]; | ||
// XCTAssertNil([bsg_SSKeychain passwordForService:kBugsnagUserEmailAddress account:kBugsnagUserKeychainAccount]); | ||
// XCTAssertEqualObjects([bsg_SSKeychain passwordForService:kBugsnagUserName account:kBugsnagUserKeychainAccount], name); | ||
// XCTAssertNil([bsg_SSKeychain passwordForService:kBugsnagUserUserId account:kBugsnagUserKeychainAccount]); | ||
|
||
[config setUser:nil withName:nil andEmail:email]; | ||
[config setUser:nil withEmail:nil andName:name]; | ||
// XCTAssertEqualObjects([bsg_SSKeychain passwordForService:kBugsnagUserEmailAddress account:kBugsnagUserKeychainAccount], email); | ||
// XCTAssertNil([bsg_SSKeychain passwordForService:kBugsnagUserName account:kBugsnagUserKeychainAccount]); | ||
// XCTAssertNil([bsg_SSKeychain passwordForService:kBugsnagUserUserId account:kBugsnagUserKeychainAccount]); | ||
|
@@ -466,10 +469,10 @@ - (void)testAllUserDataNilPersistence { | |
XCTAssertTrue(config.persistUser); | ||
[config deletePersistedUserData]; | ||
|
||
[config setUser:nil withName:nil andEmail:nil]; | ||
[config setUser:nil withEmail:nil andName:nil]; | ||
|
||
// currentUser should have been set | ||
XCTAssertNotNil(config.currentUser); | ||
XCTAssertNotNil(config.user); | ||
|
||
// But there hould be no persisted data | ||
// XCTAssertNil([bsg_SSKeychain passwordForService:kBugsnagUserEmailAddress account:kBugsnagUserKeychainAccount]); | ||
|
@@ -495,7 +498,7 @@ - (void)testUserPersistenceAndMetadata { | |
// XCTAssertNil([bsg_SSKeychain passwordForService:kBugsnagUserUserId account:kBugsnagUserKeychainAccount]); | ||
|
||
// Persist user data | ||
[config setUser:userId withName:name andEmail:email]; | ||
[config setUser:userId withEmail:email andName:name]; | ||
|
||
// Check that retrieving persisted user data also sets configuration metadata | ||
// Check persistence between invocations (when values have been set) | ||
|
@@ -528,7 +531,7 @@ - (void)testNonPersistenceAndMetadata { | |
// XCTAssertNil([[config2 metadata] getMetadata:BSGKeyUser key:BSGKeyName]); | ||
// XCTAssertNil([[config2 metadata] getMetadata:BSGKeyUser key:BSGKeyEmail]); | ||
|
||
[config2 setUser:userId withName:name andEmail:email]; | ||
[config2 setUser:userId withEmail:email andName:name]; | ||
// XCTAssertEqualObjects([config2.metadata getMetadata:BSGKeyUser key:BSGKeyEmail], email); | ||
// XCTAssertEqualObjects([config2.metadata getMetadata:BSGKeyUser key:BSGKeyName], name); | ||
// XCTAssertEqualObjects([config2.metadata getMetadata:BSGKeyUser key:BSGKeyId], userId); | ||
|
@@ -604,11 +607,11 @@ - (void)testErrorApiHeaders { | |
- (void)testUser { | ||
BugsnagConfiguration *config = [[BugsnagConfiguration alloc] initWithApiKey:DUMMY_APIKEY_32CHAR_1]; | ||
|
||
[config setUser:@"123" withName:@"foo" andEmail:@"[email protected]"]; | ||
[config setUser:@"123" withEmail:@"[email protected]" andName:@"foo"]; | ||
|
||
XCTAssertEqualObjects(@"123", config.currentUser.userId); | ||
XCTAssertEqualObjects(@"foo", config.currentUser.name); | ||
XCTAssertEqualObjects(@"[email protected]", config.currentUser.emailAddress); | ||
XCTAssertEqualObjects(@"123", config.user.userId); | ||
XCTAssertEqualObjects(@"foo", config.user.name); | ||
XCTAssertEqualObjects(@"[email protected]", config.user.emailAddress); | ||
} | ||
|
||
- (void)testApiKeySetter { | ||
|
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 |
---|---|---|
|
@@ -45,7 +45,7 @@ - (void)testStartNewSession { | |
} | ||
|
||
- (void)testStartNewSessionWithUser { | ||
[self.configuration setUser:@"123" withName:@"Bill" andEmail:nil]; | ||
[self.configuration setUser:@"123" withEmail:nil andName:@"Bill"]; | ||
XCTAssertNil(self.sessionTracker.runningSession); | ||
[self.sessionTracker startNewSession]; | ||
BugsnagSession *session = self.sessionTracker.runningSession; | ||
|
@@ -74,7 +74,7 @@ - (void)testStartNewAutoCapturedSession { | |
} | ||
|
||
- (void)testStartNewAutoCapturedSessionWithUser { | ||
[self.configuration setUser:@"123" withName:@"Bill" andEmail:@"[email protected]"]; | ||
[self.configuration setUser:@"123" withEmail:@"[email protected]" andName:@"Bill"]; | ||
XCTAssertNil(self.sessionTracker.runningSession); | ||
[self.sessionTracker startNewSessionIfAutoCaptureEnabled]; | ||
BugsnagSession *session = self.sessionTracker.runningSession; | ||
|
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 |
---|---|---|
|
@@ -11,7 +11,7 @@ | |
@implementation AutoSessionWithUserScenario | ||
|
||
- (void)startBugsnag { | ||
[self.config setUser:@"123" withName:@"Joe Bloggs" andEmail:@"[email protected]"]; | ||
[self.config setUser:@"123" withEmail:@"[email protected]" andName:@"Joe Bloggs"]; | ||
[super startBugsnag]; | ||
} | ||
|
||
|
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 |
---|---|---|
|
@@ -11,7 +11,7 @@ | |
@implementation ManualSessionWithUserScenario | ||
|
||
- (void)startBugsnag { | ||
[self.config setUser:@"123" withName:@"Joe Bloggs" andEmail:@"[email protected]"]; | ||
[self.config setUser:@"123" withEmail:@"[email protected]" andName:@"Joe Bloggs"]; | ||
self.config.autoTrackSessions = NO; | ||
[super startBugsnag]; | ||
} | ||
|
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 |
---|---|---|
|
@@ -16,7 +16,7 @@ internal class UserEmailScenario: Scenario { | |
} | ||
|
||
override func run() { | ||
Bugsnag.setUser(nil, withName: nil, andEmail: "[email protected]") | ||
Bugsnag.setUser(nil, withEmail: "[email protected]", andName: nil) | ||
let error = NSError(domain: "UserEmailScenario", code: 100, userInfo: nil) | ||
Bugsnag.notifyError(error) | ||
} | ||
|
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 |
---|---|---|
|
@@ -17,7 +17,7 @@ internal class UserEnabledScenario: Scenario { | |
} | ||
|
||
override func run() { | ||
Bugsnag.setUser("123", withName: "Joe Bloggs", andEmail: "[email protected]") | ||
Bugsnag.setUser("123", withEmail: "[email protected]", andName: "Joe Bloggs") | ||
let error = NSError(domain: "UserEnabledScenario", code: 100, userInfo: nil) | ||
Bugsnag.notifyError(error) | ||
} | ||
|
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
Oops, something went wrong.