Giter Site home page Giter Site logo

spring-week6-assignment-1's Introduction

로그인 만들기

demo mov

과제 목표

지금은 모든 기능을 로그인을 하지 않고 사용할 수 있습니다. 고양이 장난감을 새로 등록하거나 수정, 삭제하는 기능은 인증된 사용자만이 사용할 수 있어야 합니다. JWT를 이용해서 인증을 구현하여 로그인을 만들고 인증된 사람만 기능을 사용할 수 있도록 만들어주세요.

로그인이 필요없는 API

  • 로그인 - POST /session
  • 회원 생성하기 - POST /users
  • 회원 수정하기 - POST /users/{id}
  • 회원 삭제하기 - DELETE /users/{id}
  • 고양이 장난감 목록 얻기 - GET /products
  • 고양이 장난감 상세 조회하기 - GET /products/{id}

로그인이 필요한 API

  • 고양이 장난감 등록하기 - POST /products
  • 고양이 장난감 수정하기 - PATCH /products/{id}
  • 고양이 장난감 삭제하기 - DELETE /products/{id}

요구 사항

  • 테스트 커버리지 100%를 달성해야 합니다.
  • 모든 API 테스트를 통과해야 합니다.
  • 모든 E2E 테스트를 통과해야 합니다.

API 실행하기

./gradlew run

웹 실행하기

설치

$ cd web
$ npm install

실행

$ npm start

브라우저 http://localhost:9000로 열면 실행된 것을 확인할 수 있습니다.

테스트

Spring 테스트 실행

$ ./gradlew test

커버리지 확인하기

테스트를 실행하면 자동으로 커버리지 정보를 수집하여 저장합니다. 커버리지 정보는 app/build/reports 폴더에 저장됩니다. 커버리지 정보를 확인하려면 app/build/reports/jacoco/test/html/index.html파일을 브라우저에서 열면 확인할 수 있습니다.

API 테스트 설치하기

$ cd tests
$ npm install

API 테스트 실행

테스트는 실제로 동작하는 서버에 테스트하므로 서버가 동작하고 있는 상태여야 올바르게 동작합니다.

$ npm test

E2E 테스트 실행하기

E2E테스트는 실제로 동작하는 서버와 실제로 동작하는 웹이 필요한 테스트하므로 서버가 동작하고, 웹 서버가 동작하고 있는 상태여야 올바르게 동작합니다.

$ cd web
$ npm run e2e

spring-week6-assignment-1's People

Contributors

hannut91 avatar joowankim avatar yangseungin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

spring-week6-assignment-1's Issues

repository의 about 오타

이 repository의 about에 코드슴이라는 오타가 있네요! 코드숨으로 변경하면 좋을 것 같아요.

스크린샷 2021-03-02 오후 10 00 24

session API test 반환값 오류

다음은 api test 중 session.spec.js에 있는 테스트 중 하나입니다.

    context('with not exists user', () => {
      it('responses token', async () => {
        await frisby.post('/session', {
          email: '[email protected]',
          password: 'wrong password',
        })
          .expect('status', 400);
      });
    });

위 테스트는 존재하지 않는 유저에 대한 response를 받는 테스트입니다.
그렇다면 부적절한 파라미터 값에 대한 예외가 아니라 존재하지 않는 유저를 찾을 수 없기 때문에 나는 에러로 404 status가 반환되어야 합니다.
하지만 테스트에서는 400 status를 기대하고 있습니다.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.