Ejemplo n.º 1
0
    def setUp(self):
        app.testing = True
        self.app = app.test_client()
        with app.test_request_context():
            db.create_all()
            user = {"tipo": 'admin', "email": "*****@*****.**", "password": '******'}
            headers = {"Content-Type": 'application/json'}

            login = requests.post(
                'https://choutuve-app-server.herokuapp.com/login',
                headers=headers,
                data=json.dumps(user))
            self.token = login.text
Ejemplo n.º 2
0
def client():
    with app.test_request_context():
        yield TestApp(app)
Ejemplo n.º 3
0
import os
import sys
from flask import *
from __init__ import app
from flask.ext.sqlalchemy import SQLAlchemy
# if you add blueprints, import their models as below
from apps.example.models import *

app.testing = True
app.test_client()
ctx = app.test_request_context()
ctx.push()
print "app and db have been imported."
print "You have a test client: client,\nand a test request context: ctx"
Ejemplo n.º 4
0
 def tearDown(self):
     with app.test_request_context():
         db.drop_all()