mirror of
				https://github.com/KevinMidboe/immich.git
				synced 2025-10-29 17:40:28 +00:00 
			
		
		
		
	refactor(web,server): use feature flags for oauth (#3928)
* refactor: oauth to use feature flags * chore: open api * chore: e2e test for authorize endpoint
This commit is contained in:
		
							
								
								
									
										42
									
								
								server/test/e2e/oauth.e2e-spec.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										42
									
								
								server/test/e2e/oauth.e2e-spec.ts
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,42 @@
 | 
			
		||||
import { AppModule, OAuthController } from '@app/immich';
 | 
			
		||||
import { INestApplication } from '@nestjs/common';
 | 
			
		||||
import { Test, TestingModule } from '@nestjs/testing';
 | 
			
		||||
import request from 'supertest';
 | 
			
		||||
import { errorStub } from '../fixtures';
 | 
			
		||||
import { api, db } from '../test-utils';
 | 
			
		||||
 | 
			
		||||
describe(`${OAuthController.name} (e2e)`, () => {
 | 
			
		||||
  let app: INestApplication;
 | 
			
		||||
  let server: any;
 | 
			
		||||
 | 
			
		||||
  beforeAll(async () => {
 | 
			
		||||
    const moduleFixture: TestingModule = await Test.createTestingModule({
 | 
			
		||||
      imports: [AppModule],
 | 
			
		||||
    }).compile();
 | 
			
		||||
 | 
			
		||||
    app = await moduleFixture.createNestApplication().init();
 | 
			
		||||
    server = app.getHttpServer();
 | 
			
		||||
  });
 | 
			
		||||
 | 
			
		||||
  beforeEach(async () => {
 | 
			
		||||
    await db.reset();
 | 
			
		||||
    await api.adminSignUp(server);
 | 
			
		||||
  });
 | 
			
		||||
 | 
			
		||||
  afterAll(async () => {
 | 
			
		||||
    await db.disconnect();
 | 
			
		||||
    await app.close();
 | 
			
		||||
  });
 | 
			
		||||
 | 
			
		||||
  describe('POST /oauth/authorize', () => {
 | 
			
		||||
    beforeEach(async () => {
 | 
			
		||||
      await db.reset();
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    it(`should throw an error if a redirect uri is not provided`, async () => {
 | 
			
		||||
      const { status, body } = await request(server).post('/oauth/authorize').send({});
 | 
			
		||||
      expect(status).toBe(400);
 | 
			
		||||
      expect(body).toEqual(errorStub.badRequest);
 | 
			
		||||
    });
 | 
			
		||||
  });
 | 
			
		||||
});
 | 
			
		||||
		Reference in New Issue
	
	Block a user