def setUp(self): init_for('testing') app.config['TESTING'] = True db.app = app db.create_all() self.db = db make_fixtures()
def setUpClass(cls): """ Initialize a test DB and call to make fixtures. """ cls.app = app db.create_all() cls.fixtures = Fixtures() cls.fixtures.make_fixtures() cls.fixtures.test_client = app.test_client()
def setUpClass(cls): """ Initialize a test DB and call to make fixtures. """ cls.app = app db.create_all() cls.fixtures = Fixtures() cls.fixtures.make_fixtures() cls.fixtures.test_client = app.test_client()
def setUp(self): """ Initialize a test DB and call to make fixtures. """ self.ctx = app.test_request_context() self.ctx.push() self.app = app db.create_all() self.client = app.test_client() self.fixtures = Fixtures() self.fixtures.make_fixtures()
def setUp(self): """ Initialize a test DB and call to make fixtures. """ self.ctx = app.test_request_context() self.ctx.push() self.app = app db.create_all() self.client = app.test_client() self.fixtures = Fixtures() self.fixtures.make_fixtures()
#!/usr/bin/env python # -*- coding: utf-8 -*- import sys reload(sys) sys.setdefaultencoding('utf-8') from lastuserapp import app, db from lastuser_core.models import * #incase data exists from previously run tests db.drop_all() #create schema again db.create_all() # Add fixtures for test app # user for CRUD workflow: creating client app gustav = User(username=u"gustav", fullname=u"Gustav 'world' Dachshund", password='******') # org for associating with client # client for CRUD workflow of defining perms *in* client # spare user for CRUD workflow of assigning permissions oakley = User(username=u"oakley", fullname=u"Oakley 'huh' Dachshund") dachsunited = Organization(name=u"dachsunited", title=u"Dachs United") dachsunited.owners.users.append(gustav) dachsunited.members.users.append(oakley) dachshundworld = Client(title=u"Dachshund World", org=dachsunited, confidential=True, website=u"http://gustavsdachshundworld.com") partyanimal = Permission(name=u"partyanimal", title=u"Party Animal", org=dachsunited) db.session.add(gustav) db.session.add(oakley) db.session.add(dachsunited)
#!/usr/bin/env python # -*- coding: utf-8 -*- import sys reload(sys) sys.setdefaultencoding('utf-8') from lastuserapp import app, db from lastuser_core.models import * #incase data exists from previously run tests db.drop_all() #create schema again db.create_all() # Add fixtures for test app # user for CRUD workflow: creating client app gustav = User(username=u"gustav", fullname=u"Gustav 'world' Dachshund", password='******') # org for associating with client # client for CRUD workflow of defining perms *in* client # spare user for CRUD workflow of assigning permissions oakley = User(username=u"oakley", fullname=u"Oakley 'huh' Dachshund") dachsunited = Organization(name=u"dachsunited", title=u"Dachs United") dachsunited.owners.users.append(gustav) dachsunited.members.users.append(oakley) dachshundworld = Client(title=u"Dachshund World", org=dachsunited, confidential=True,