コード例 #1
0
ファイル: tests.py プロジェクト: olujicz/api
 def test_me(self):
     from onelove.models import User
     url = '/api/v0/me'
     data = self.get(url)
     del data['id']
     api_user = User(data)
     api_user.pk = self.me.pk
     self.assertEqual(self.me, api_user)
コード例 #2
0
ファイル: tests.py プロジェクト: mlrdk/backend
 def test_me(self):
     from onelove.models import User
     url = '/api/v0/me'
     data = self.get(url)
     del data['id']
     api_user = User(data)
     api_user.pk = self.me.pk
     self.assertEqual(self.me, api_user)
コード例 #3
0
ファイル: create_default_admin.py プロジェクト: mlrdk/backend
#!/usr/bin/env python
from flask_security.utils import encrypt_password

from backend import onelove
from onelove.models import User

ctx = onelove.app.test_request_context().push()

# Create admin user
try:
    user = User.objects.get(email='*****@*****.**')
except User.DoesNotExist:
    user = User(email='*****@*****.**')
    user.password = encrypt_password('Sekrit')
    user.username = '******'
    user.active = True
    user.save()

# Create admin role
admin_role = onelove.user_datastore.find_or_create_role(
    name="admin", description="Administrator")

# Add admin user to admin role
onelove.user_datastore.add_role_to_user(user, admin_role)
コード例 #4
0
#!/usr/bin/env python
from flask_security.utils import encrypt_password

from backend import onelove
from onelove.models import User


ctx = onelove.app.test_request_context().push()

# Create admin user
try:
    user = User.objects.get(email='*****@*****.**')
except User.DoesNotExist:
    user = User(email='*****@*****.**')
    user.password = encrypt_password('Sekrit')
    user.username = '******'
    user.active = True
    user.save()

# Create admin role
admin_role = onelove.user_datastore.find_or_create_role(
    name="admin",
    description="Administrator"
)

# Add admin user to admin role
onelove.user_datastore.add_role_to_user(user, admin_role)