mirror of
https://github.com/n8n-io/n8n.git
synced 2024-11-10 06:34:05 -08:00
fix: Auth.api user limit test expecting incorrect status (#6836)
fix: auth.api user limit test expecting incorrect status
This commit is contained in:
parent
732416f52f
commit
371bfa0f48
|
@ -68,10 +68,16 @@ describe('POST /login', () => {
|
|||
|
||||
test('should throw AuthError for non-owner if not within users limit quota', async () => {
|
||||
jest.spyOn(Container.get(License), 'isWithinUsersLimit').mockReturnValueOnce(false);
|
||||
const member = await testDb.createUserShell(globalMemberRole);
|
||||
const password = 'testpassword';
|
||||
const member = await testDb.createUser({
|
||||
password,
|
||||
});
|
||||
|
||||
const response = await testServer.authAgentFor(member).get('/login');
|
||||
expect(response.statusCode).toBe(401);
|
||||
const response = await testServer.authlessAgent.post('/login').send({
|
||||
email: member.email,
|
||||
password,
|
||||
});
|
||||
expect(response.statusCode).toBe(403);
|
||||
});
|
||||
|
||||
test('should not throw AuthError for owner if not within users limit quota', async () => {
|
||||
|
|
|
@ -93,10 +93,8 @@ function createAgent(app: express.Application, options?: { auth: boolean; user:
|
|||
const agent = request.agent(app);
|
||||
void agent.use(prefix(REST_PATH_SEGMENT));
|
||||
if (options?.auth && options?.user) {
|
||||
try {
|
||||
const { token } = issueJWT(options.user);
|
||||
agent.jar.setCookie(`${AUTH_COOKIE_NAME}=${token}`);
|
||||
} catch {}
|
||||
const { token } = issueJWT(options.user);
|
||||
agent.jar.setCookie(`${AUTH_COOKIE_NAME}=${token}`);
|
||||
}
|
||||
return agent;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue