Mercurial > public > src > rhodecode
diff pylons_app/lib/db_manage.py @ 535:fefffd6fd5f4 celery
Added some more tests, rewrite testing schema, to autogenerate fresh db, new index.
cleaned up some codes that involves testing.
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Tue, 21 Sep 2010 01:08:01 +0200 |
parents | ac559565c6b8 |
children | 53aa1ee1af86 |
line wrap: on
line diff
--- a/pylons_app/lib/db_manage.py Mon Sep 20 22:55:55 2010 +0200 +++ b/pylons_app/lib/db_manage.py Tue Sep 21 01:08:01 2010 +0200 @@ -43,7 +43,7 @@ log = logging.getLogger(__name__) class DbManage(object): - def __init__(self, log_sql, dbname,tests=False): + def __init__(self, log_sql, dbname, tests=False): self.dbname = dbname self.tests = tests dburi = 'sqlite:////%s' % jn(ROOT, self.dbname) @@ -68,7 +68,7 @@ if override: log.info("database exisist and it's going to be destroyed") if self.tests: - destroy=True + destroy = True else: destroy = ask_ok('Are you sure to destroy old database ? [y/n]') if not destroy: @@ -84,15 +84,17 @@ import getpass username = raw_input('Specify admin username:') password = getpass.getpass('Specify admin password:') - self.create_user(username, password, True) + email = raw_input('Specify admin email:') + self.create_user(username, password, email, True) else: log.info('creating admin and regular test users') - self.create_user('test_admin', 'test', True) - self.create_user('test_regular', 'test', False) + self.create_user('test_admin', 'test', 'test_admin@mail.com', True) + self.create_user('test_regular', 'test', 'test_regular@mail.com', False) + self.create_user('test_regular2', 'test', 'test_regular2@mail.com', False) - def config_prompt(self,test_repo_path=''): + def config_prompt(self, test_repo_path=''): log.info('Setting up repositories config') if not self.tests and not test_repo_path: @@ -102,7 +104,7 @@ path = test_repo_path if not os.path.isdir(path): - log.error('You entered wrong path: %s',path) + log.error('You entered wrong path: %s', path) sys.exit() hooks1 = HgAppUi() @@ -166,14 +168,14 @@ raise log.info('created ui config') - def create_user(self, username, password, admin=False): + def create_user(self, username, password, email='', admin=False): log.info('creating administrator user %s', username) new_user = User() new_user.username = username new_user.password = get_crypt_password(password) new_user.name = 'Hg' new_user.lastname = 'Admin' - new_user.email = 'admin@localhost.com' + new_user.email = email new_user.admin = admin new_user.active = True