forked from openedx/frontend-platform
-
Notifications
You must be signed in to change notification settings - Fork 0
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 openedx#12 from edx/robrap/ARCH-379-get-user-id
feat(authentication): add userId and drop email
- Loading branch information
Showing
3 changed files
with
6 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,7 +19,7 @@ const tomorrow = new Date(); | |
tomorrow.setDate(tomorrow.getDate() + 1); | ||
|
||
const jwt = { | ||
email: '[email protected]', | ||
user_id: '12345', | ||
preferred_username: 'test', | ||
}; | ||
const expiredJwt = Object.assign({ exp: yesterday.getTime() / 1000 }, jwt); | ||
|
@@ -156,7 +156,9 @@ describe('AuthenticatedAPIClient auth interface', () => { | |
it('has method getAuthenticationState that returns authentication state when valid JWT cookie exists', () => { | ||
mockCookies.get.mockReturnValueOnce(encodedValidJwt); | ||
const result = client.getAuthenticationState(); | ||
expect(result.authentication.email).toEqual(validJwt.email); | ||
expect(result.authentication.userId).toBeDefined(); | ||
expect(result.authentication.userId).toEqual(validJwt.user_id); | ||
expect(result.authentication.username).toBeDefined(); | ||
expect(result.authentication.username).toEqual(validJwt.preferred_username); | ||
}); | ||
|
||
|
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 |
---|---|---|
|
@@ -42,7 +42,7 @@ describe('PrivateRoute', () => { | |
it('renders private component if authenticated', () => { | ||
const store = mockStore({ | ||
authentication: { | ||
email: '[email protected]', | ||
userId: '12345', | ||
username: 'test', | ||
}, | ||
}); | ||
|