def test_no_create(self): # testing the create_tables option testsdir = os.path.dirname(__file__) conf = os.path.join(testsdir, 'tests_nocreate.ini') appdir, config, auth = initenv(conf) # this should fail because the table is absent self.assertRaises(BackendError, auth.authenticate_user, 'tarek', 'tarek')
def test_no_pool(self): # checks that sqlite gets the NullPool by default testsdir = os.path.dirname(__file__) conf = os.path.join(testsdir, 'tests_nocreate.ini') appdir, config, auth = initenv(conf) try: self.assertTrue(isinstance(auth._engine.pool, NullPool)) finally: cleanupenv(conf)
def test_no_create(self): # testing the create_tables option testsdir = os.path.dirname(__file__) conf = os.path.join(testsdir, 'tests.ini') appdir, config, auth = initenv(conf) # this should fail because the table is absent self.assertRaises(BackendError, auth.authenticate_user, 'tarek', 'tarek')
def setUp(self): self.appdir, self.config, self.auth = initenv() # we don't support other storages for this test assert self.auth.sqluri.split(':/')[0] in ('mysql', 'sqlite') # lets add a user tarek/tarek password = ssha('tarek') query = text('insert into users (username, password_hash, status) ' 'values (:username, :password, 1)') self.auth._engine.execute(query, username='******', password=password) self.user_id = self.auth._engine.execute('select id from users where' ' username="******"').fetchone().id
def setUp(self): initenv() self.oldopen = urllib2.urlopen urllib2.urlopen = self._urlopen