-
Notifications
You must be signed in to change notification settings - Fork 0
추가기능 API (최근 많이 사용한 태그 추천, 내 게시물 단기간 조회수 급상승) #21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
JaeHyuckSa
wants to merge
4
commits into
develop
Choose a base branch
from
feature/issue-014
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
e080d79
:recycle:Refact: decorator 오타 수정 #14
JaeHyuckSa bc46168
:sparkles:Feat: hashtag MTM model 커스텀 #14 #4
JaeHyuckSa 1a89803
:white_check_mark:Test: 해시태그 추천 리스트 API 테스트 코드 작성 #14
JaeHyuckSa 3bc3416
:sparkles:Feat: 최근 가장 많이 사용된 hashtag 조회 API
JaeHyuckSa File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
File renamed without changes.
This file contains hidden or 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 hidden or 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 was deleted.
Oops, something went wrong.
This file contains hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| from django.urls import reverse | ||
| from rest_framework import status | ||
| from rest_framework.test import APITestCase | ||
|
|
||
| from posts.models import HashTag, Post | ||
| from users.models import User | ||
|
|
||
|
|
||
| class HashTagRecommendListViewTest(APITestCase): | ||
| @classmethod | ||
| def setUpTestData(cls): | ||
| cls.hasgtag1 = HashTag.objects.create( | ||
| name="hashtag1", | ||
| ) | ||
| cls.hasgtag2 = HashTag.objects.create( | ||
| name="hashtag2", | ||
| ) | ||
| for i in range(1, 10): | ||
| cls.users = User.objects.create_user( | ||
| email=f"user{i}@example.com", | ||
| password="testpassword", | ||
| ) | ||
| cls.posts = Post.objects.create( | ||
| post_type="facebook", | ||
| title=f"title {i}", | ||
| content=f"content {i}", | ||
| view_count=i, | ||
| like_count=i, | ||
| share_count=i, | ||
| user=cls.users, | ||
| ) | ||
| if i % 2 == 0: | ||
| cls.posts.hashtag_set.set([cls.hasgtag2]) | ||
| else: | ||
| cls.posts.hashtag_set.set([cls.hasgtag1, cls.hasgtag2]) | ||
|
|
||
| def setUp(self): | ||
| pass | ||
| # self.access_token = self.client.post(reverse("token_obtain_pair"), self.user_data).data["access"] | ||
|
|
||
| def test_get_hash_tag_recommend_list_success(self): | ||
| response = self.client.get( | ||
| path=reverse("hashtag_recommend_list"), | ||
| # HTTP_AUTHORIZATION=f"Bearer {self.access_token}", | ||
| ) | ||
| self.assertEqual(response.data[0]["id"], 2) | ||
| self.assertEqual(response.data[0]["name"], "hashtag2") | ||
| self.assertEqual(response.status_code, status.HTTP_200_OK) | ||
|
|
||
| # @TODO: 로그인 로직 구현 후 주석 풀기 @SaJH | ||
| # def test_get_hash_tag_recommend_list_fail_unauthenticated(self): | ||
| # response = self.client.get( | ||
| # path=reverse("hashtag_recommend_list"), | ||
| # ) | ||
| # self.assertEqual(response.status_code, status.HTTP_401_UNAUTHORIZED) |
This file contains hidden or 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 hidden or 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 |
|---|---|---|
| @@ -1,7 +1,8 @@ | ||
| from django.urls import path | ||
|
|
||
| from posts.views import StatisticsListView | ||
| from posts.views import HashTagRecommendListView, StatisticsListView | ||
|
|
||
| urlpatterns = [ | ||
| path("statistics/", StatisticsListView.as_view(), name="statistics"), | ||
| path("statistics/", StatisticsListView.as_view(), name="statistics_list"), | ||
| path("hashtag/recommend/", HashTagRecommendListView.as_view(), name="hashtag_recommend_list"), | ||
| ] |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.