-
Notifications
You must be signed in to change notification settings - Fork 80
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
> Auto init the account when auth * 🧶 Added `findOrCreateUser` method. Initialize account on both login and authorization, as per the submitted GitHub." ------ > 授权时,默认进行账户初始化 * 🧶 新增 `findOrCreateUser` 方法,登录和授权时均初始化账户
- Loading branch information
Showing
3 changed files
with
13 additions
and
13 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -135,21 +135,20 @@ describe('test/port/controller/TokenController/createToken.test.ts', () => { | |
assert.match(res.body.error, /\[FORBIDDEN\] need login first/); | ||
}); | ||
|
||
it('should 403 when no user info', async () => { | ||
it('should auto create when no user info', async () => { | ||
mock(AuthAdapter.prototype, 'ensureCurrentUser', async () => { | ||
return { | ||
name: 'banana', | ||
email: '[email protected]', | ||
}; | ||
}); | ||
const res = await app.httpRequest() | ||
await app.httpRequest() | ||
.post('/-/npm/v1/tokens/gat') | ||
.send({ | ||
name: 'banana', | ||
expires: 30, | ||
}) | ||
.expect(403); | ||
assert.match(res.body.error, /\[FORBIDDEN\] invalid user info/); | ||
.expect(200); | ||
}); | ||
|
||
describe('should 200', () => { | ||
|