-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
63 changed files
with
236 additions
and
7 deletions.
There are no files selected for viewing
This file contains 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 |
---|---|---|
|
@@ -95,3 +95,4 @@ db.sqlite3 | |
!*/migrations/__init__.py | ||
.vscode/ | ||
*.DS_Store | ||
*migrations |
This file contains 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file modified
0
authors/apps/authentication/templates/alert_reset_password.html
100644 → 100755
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
This file contains 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 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 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,118 @@ | ||
from django.urls import reverse | ||
from rest_framework.test import APIClient | ||
from rest_framework.test import APITestCase | ||
from rest_framework import status | ||
|
||
|
||
class TestFollowUserProfile(APITestCase): | ||
""" setup class for follow profile tests""" | ||
|
||
def setUp(self): | ||
""" | ||
Prepare test environment for each testcase | ||
""" | ||
self.client = APIClient() | ||
self.user_details = { | ||
'user': { | ||
'username': 'steel', | ||
'email': 'steel@gmail.com', | ||
'password': 'somepass12345', | ||
} | ||
} | ||
self.follow_me = { | ||
'user': { | ||
'username': 'bond', | ||
'email': 'bond@gmail.com', | ||
'password': 'somepass12345', | ||
} | ||
} | ||
|
||
self.login_data = { | ||
"user": { | ||
'email': 'steel@gmail.com', | ||
'password': 'somepass12345' | ||
} | ||
} | ||
|
||
self.login_url = reverse('authentication:login') | ||
self.signup_url = reverse('authentication:register') | ||
self.all_profiles = reverse('profile:all_profiles') | ||
self.update_profile = reverse('authentication:update_profile') | ||
|
||
def register_user(self, user_details): | ||
""" | ||
register a new user | ||
""" | ||
self.client.post( | ||
self.signup_url, | ||
user_details, | ||
format='json') | ||
|
||
def login_user(self): | ||
"""login user to get the token""" | ||
response = self.client.post( | ||
self.login_url, self.login_data, format='json') | ||
return response.data['token'] | ||
|
||
def test_follow_another_user_profile(self): | ||
""" | ||
test follow another profile | ||
""" | ||
self.register_user(self.user_details) | ||
self.register_user(self.follow_me) | ||
token = self.login_user() | ||
response = self.client.post( | ||
reverse( | ||
"profile:follow", | ||
args=['bond']), | ||
format='json', | ||
HTTP_AUTHORIZATION='Bearer ' + | ||
token) | ||
self.assertEqual(response.status_code, status.HTTP_201_CREATED) | ||
self.assertIn('True', str(response.data)) | ||
|
||
def test_un_follow_another_user_profile(self): | ||
""" | ||
test un follow another profile | ||
""" | ||
self.register_user(self.user_details) | ||
self.register_user(self.follow_me) | ||
token = self.login_user() | ||
response = self.client.delete( | ||
reverse( | ||
"profile:follow", | ||
args=['bond']), | ||
format='json', HTTP_AUTHORIZATION='Bearer ' + token) | ||
self.assertEqual(response.status_code, status.HTTP_200_OK) | ||
self.assertIn('False', str(response.data)) | ||
|
||
def test_follow_my_self(self): | ||
""" | ||
test follow myself | ||
""" | ||
self.register_user(self.user_details) | ||
self.register_user(self.follow_me) | ||
token = self.login_user() | ||
response = self.client.post( | ||
reverse( | ||
"profile:follow", | ||
args=['steel']), | ||
format='json', HTTP_AUTHORIZATION='Bearer ' + token) | ||
self.assertEqual(response.status_code, status.HTTP_409_CONFLICT) | ||
self.assertIn( | ||
'You can only follow others, not yourself', str(response.data)) | ||
|
||
def test_follow_without_authentication(self): | ||
""" | ||
test follow another profile | ||
""" | ||
self.register_user(self.user_details) | ||
self.register_user(self.follow_me) | ||
response = self.client.post( | ||
reverse( | ||
"profile:follow", | ||
args=['steel']), | ||
format='json') | ||
self.assertEqual(response.status_code, status.HTTP_403_FORBIDDEN) | ||
self.assertIn( | ||
'Authentication credentials were not provided', str(response.data)) |
This file contains 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 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
Empty file.
Empty file.
Empty file.
This file contains 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,5 +1,9 @@ | ||
#!/usr/bin/env bash | ||
python manage.py makemigrations authentication | ||
python manage.py migrate authentication | ||
python managy.py makemigrations article | ||
python manage.py migrate article | ||
python manage.py makemigrations profiles | ||
python manage.py migrate profiles | ||
python manage.py makemigrations | ||
python manage.py migrate |
This file contains 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