forked from 3wordchant/capsul-flask
a4837aff87
NB capsul create isn't working properly, see #83
29 lines
825 B
Python
29 lines
825 B
Python
import os
|
|
from nanoid import generate
|
|
|
|
from flask_testing import TestCase
|
|
|
|
from capsulflask import create_app
|
|
from capsulflask.db import get_model
|
|
|
|
class BaseTestCase(TestCase):
|
|
def create_app(self):
|
|
# Use default connection paramaters
|
|
os.environ['POSTGRES_CONNECTION_PARAMETERS'] = "host=localhost port=5432 user=postgres password=dev dbname=capsulflask_test"
|
|
os.environ['TESTING'] = '1'
|
|
os.environ['SPOKE_MODEL'] = 'mock'
|
|
os.environ['HUB_MODEL'] = 'mock'
|
|
return create_app()
|
|
|
|
def setUp(self):
|
|
pass
|
|
|
|
def tearDown(self):
|
|
pass
|
|
|
|
def _login(self, user_email):
|
|
get_model().login(user_email)
|
|
with self.client.session_transaction() as session:
|
|
session['account'] = user_email
|
|
session['csrf-token'] = generate()
|