-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #253 from FroggyTaipei/staging
Release 1.0.6 on release
- Loading branch information
Showing
408 changed files
with
139 additions
and
260,300 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
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,42 @@ | ||
import logging | ||
from datetime import datetime | ||
from django.core.management.base import BaseCommand | ||
|
||
from apps.users.utils import jwt_encode_handler | ||
from apps.users.models import User | ||
|
||
|
||
logger = logging.getLogger('raven') | ||
|
||
|
||
class Command(BaseCommand): | ||
help = 'Create an superuser with JWT token for testing.' | ||
|
||
def add_arguments(self, parser): | ||
parser.add_argument('email', type=str, help='User email') | ||
parser.add_argument('password', type=str, help='User password') | ||
|
||
def handle(self, *args, **kwargs): | ||
email = kwargs['email'] | ||
password = kwargs['password'] | ||
|
||
if not User.objects.filter(email=email).first(): | ||
superuser = User.objects.create_superuser(email=email, password=password, | ||
full_name='Test Superuser') | ||
payload = { | ||
'id': superuser.pk, | ||
'exp': datetime(year=2030, month=1, day=1), | ||
} | ||
token = jwt_encode_handler(payload) | ||
logger.info(f""" | ||
Your initial superuser has been set for testing, use this user to sign in Django admin: | ||
Email: {email} | ||
Password: {password} | ||
Use this token for jwt testing, expired in 2030/01/01: | ||
Authorization: JWT {token} | ||
""") |
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -5,12 +5,6 @@ | |
|
||
|
||
class UserModelTestCase(TransactionTestCase): | ||
def test_create_superuser_by_script(self): | ||
"""Load superuser""" | ||
from apps.users.tests import initial | ||
self.superuser = User.objects.first() | ||
self.assertIsNotNone(self.superuser) | ||
|
||
def test_create_normal_user(self): | ||
user = User.objects.create_user(email='[email protected]', password='123456', is_staff=True, is_superuser=True) | ||
self.assertTrue(user.is_staff) | ||
|
@@ -34,4 +28,4 @@ def test_create_accountkit_use(self): | |
User.objects.create_accountkit_user(mobile=None, email=None) | ||
|
||
with self.assertRaises(ValidationError): | ||
user = User.objects.create_accountkit_user(mobile='0912345679', is_staff=True, is_superuser=True) | ||
User.objects.create_accountkit_user(mobile='0912345679', is_staff=True, is_superuser=True) |
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
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 |
---|---|---|
|
@@ -11,6 +11,7 @@ python manage.py collectstatic --noinput --verbosity 0 | |
|
||
python manage.py loaddata region type site sendgrid-template.yaml | ||
python manage.py loaddata cases.test.yaml arranges.test.yaml | ||
echo "from apps.users.tests import initial" | python manage.py shell | ||
|
||
python manage.py init_superuser [email protected] 123456 | ||
|
||
python manage.py runserver_plus 0.0.0.0:8000 |
Oops, something went wrong.