Skip to content

Add Delete Post With Delete API#34

Open
wlsrn3684 wants to merge 2 commits intomainfrom
jingu-step2-delete-post-with-delete
Open

Add Delete Post With Delete API#34
wlsrn3684 wants to merge 2 commits intomainfrom
jingu-step2-delete-post-with-delete

Conversation

@wlsrn3684
Copy link
Collaborator

@wlsrn3684 wlsrn3684 commented Jul 7, 2021

  1. 테스트
  • 조건
    1. post 1개를 생성
  • 시나리오
    1. 유효한 author id와 note id가 주어졌을 때
      • 상태 코드는 NO_CONTENT(204)를 반환
      • post의 총 개수가 0개
    2. 유효하지 않은 note id가 주어졌을 때
      • 상태 코드는 NOT_FOUNT(404)를 반환
      • message로 "post를 찾을 수 없습니다."를 반환
      • post는 삭제되지 않음
    3. 유효하지 않은 author id가 주어졌을 때
      • 상태 코드는 FORBIDDEN(403)를 반환
      • message로 "유효하지 않은 사용자입니다."를 반환
      • post는 삭제되지 않음
  1. 테스트 결과
    image

Comment on lines 215 to 219
def setUp(self):
super().setUp()
self.post = Post.objects.create(
author=self.author, title="test title", text="test text"
)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
def setUp(self):
super().setUp()
self.post = Post.objects.create(
author=self.author, title="test title", text="test text"
)
def setUp(self):
super().setUp()

TestPostMixin의 _create_post을 쓰면 될거 같음~(중복)


def test_post_delete_with_error_with_post_on_404(self):
# Given: 삭제 하기 위한 유효하지 않은 post_id 값이 주어지고,
request_body = json.dumps({"author": self.author.id})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick, 주석 내용이랑 맞지 않는 부분이네 # And: 로 따로 빼던지 현재 주석 내용을 좀 더 포괄적으로 적어주면 좋을것 같음

-> 주석 내용이랑 코드가 다르면, 코드 읽는 사람에게 혼란을 주고, 두번세번 더 읽어봐야함

@wlsrn3684
Copy link
Collaborator Author

넵 확인했습니다

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments