def test_single_attribute(self): assert run_tasks('init-db:test', print_call=False) == { 'init-db': [ ('action_001', 'appstack.tasks.init_db', 'blazewebtestapp.tasks.init_db'), ], }
def test_multiple_attributes(self): assert run_tasks('init-db:prod', print_call=False) == { 'init-db': [ ('action_000', 'appstack.tasks.init_db', 'blazewebtestapp.tasks.init_db'), ('action_002', 'appstack.tasks.init_db', 'blazewebtestapp.tasks.init_db'), ], }
def test_matrix_attr(self): eq_( run_tasks('attr-matrix:xattr', print_call=False), { 'attr-matrix': [ ('action_2xattr', 'appstack.tasks.attr_matrix', None), ('action_3pxattr', 'appstack.tasks.attr_matrix', None), ], })
def test_split_db_sessions(self): raise SkipTest """ something weird happens when this test runs in that test_model.py:TestFKs.test_fk_prevent_parent_update() fails when running against PGSQL (at least) """ wsgiapp = make_wsgi('SplitSessionsTest') ta = TestApp(wsgiapp) run_tasks('clear-db') run_tasks('init-db:~test') r = ta.get('/') assert 'Index Page' in r c = Car.first() assert c.make ta.get('/') assert c.make
def test_session_clear_beaker(self): # make beaker create a session table. Use the alternate profile to have # a database file, instead of in-memory, where it will get wiped before # we can check results wsgiapp = make_wsgi('BeakerSessionTest') ta = TestApp(wsgiapp) ta.get('/beaker-test') sessions_table = sa.Table( 'beaker_cache', sa.MetaData(settings.beaker.url), autoload=True ) sessions_table.delete().execute() for i in range(10): sessions_table.insert().values( namespace=randchars(20), created=dt.datetime.now(), accessed=( dt.datetime.now() - dt.timedelta(seconds=60 * 5 * i) ), data=b'55' ).execute() eq_( db.sess.execute( sa.sql.select([sa.sql.func.count('*')], from_obj=sa.sql.text('beaker_cache')) ).fetchone(), (10, ) ) # re-run the app to clear sessions wsgiapp = make_wsgi('BeakerSessionTest') eq_( db.sess.execute( sa.sql.select([sa.sql.func.count('*')], from_obj=sa.sql.text('beaker_cache')) ).fetchone(), (6, ) ) run_tasks('clear-db') run_tasks('init-db:~test')
def test_matrix_attr(self): eq_( run_tasks('attr-matrix:xattr', print_call=False), { 'attr-matrix': [ ('action_2xattr', 'appstack.tasks.attr_matrix', None), ('action_3pxattr', 'appstack.tasks.attr_matrix', None), ], } )
def test_matrix_noattr(self): eq_( run_tasks('attr-matrix', print_call=False), { 'attr-matrix': [ ('action_1noattr', 'appstack.tasks.attr_matrix', None), ('action_2xattr', 'appstack.tasks.attr_matrix', None), ('action_4mxattr', 'appstack.tasks.attr_matrix', None), ('action_5yattr', 'appstack.tasks.attr_matrix', None), ('action_7myattr', 'appstack.tasks.attr_matrix', None), ], })
def test_task(self): eq_( run_tasks(('init-db', 'init-data'), print_call=False), { 'init-db': [ ('action_000', 'appstack.tasks.init_db', 'blazewebtestapp.tasks.init_db'), ('action_001', 'appstack.tasks.init_db', 'blazewebtestapp.tasks.init_db'), ('action_001', 'compstack.routingtests.tasks.init_db', 'blazewebtestapp.components.routingtests.tasks.init_db'), ('action_001', 'compstack.tests.tasks.init_db', 'blazewebtestapp2.components.tests.tasks.init_db'), ('action_002', 'appstack.tasks.init_db', 'blazewebtestapp.tasks.init_db'), ('action_003', 'compstack.routingtests.tasks.init_db', 'blazewebtestapp2.components.routingtests.tasks.init_db'), ('action_005', 'appstack.tasks.init_db', 'blazewebtestapp2.tasks.init_db'), ], 'init-data': [ ('action_010', 'appstack.tasks.init_data', 'lots of data'), ], })
def setup_db_structure(sender): if settings.components.sqlalchemy.pre_test_init_tasks: run_tasks(settings.components.sqlalchemy.pre_test_init_tasks)
def test_notask(self): eq_(run_tasks('not-there', print_call=False), {'not-there': []})
def command(self): run_tasks(self.args, test_only=self.options.test_only)