Esempio n. 1
0
    def setUp(self):
        app = Flask(__name__)
        self.app = setup(app)
        app.login_manager.init_app(app)
        self.client = self.app.test_client(app)
        self.app_context = self.app.app_context()
        self.app_context.push()
        user = User(user_name='janedoe',
                    password='******',
                    first_name='jane',
                    last_name='doe',
                    mail='*****@*****.**')
        user2 = User(user_name='johndoe',
                     password='******',
                     first_name='john',
                     last_name='doe',
                     mail='*****@*****.**')
        db.session.add(user)
        db.session.add(user2)
        user_id = db.session.query(User).filter_by(
            user_name='janedoe').first().id
        content = Content(user_id=user_id,
                          title='test-title',
                          content='test-content',
                          display=True)
        db.session.add(content)
        db.session.commit()

        js = '{"user_name": "janedoe", "password": "******"}'
        response = self.client.post('/user/token',
                                    data=js,
                                    content_type='application/json')
        self.assertEqual(response.status_code, 200)
Esempio n. 2
0
 def setUp(self):
     app = Flask(__name__)
     self.app = setup(app)
     self.app_context = self.app.app_context()
     self.app_context.push()
     user = User(user_name='test-login-success',
                 password='******',
                 first_name='test',
                 last_name='login',
                 mail='*****@*****.**')
     db.session.add(user)
     db.session.commit()
Esempio n. 3
0
 def setUp(self):
     app = Flask(__name__)
     self.app = setup(app)
     self.app_context = self.app.app_context()
     self.app_context.push()
Esempio n. 4
0
import sys
import logging

from cyclrr import setup
from jobs import job, create_app

app = create_app()
app = setup(app)

app.cli.add_command(job)