本文整理汇总了Python中kallithea.model.meta.Session.remove方法的典型用法代码示例。如果您正苦于以下问题:Python Session.remove方法的具体用法?Python Session.remove怎么用?Python Session.remove使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kallithea.model.meta.Session
的用法示例。
在下文中一共展示了Session.remove方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setup_method
# 需要导入模块: from kallithea.model.meta import Session [as 别名]
# 或者: from kallithea.model.meta.Session import remove [as 别名]
def setup_method(self, method):
Session.remove()
u1 = UserModel().create_or_update(username=u'u1',
password=u'qweqwe',
email=u'[email protected]',
firstname=u'u1', lastname=u'u1')
Session().commit()
self.u1 = u1.user_id
u2 = UserModel().create_or_update(username=u'u2',
password=u'qweqwe',
email=u'[email protected]',
firstname=u'u2', lastname=u'u3')
Session().commit()
self.u2 = u2.user_id
u3 = UserModel().create_or_update(username=u'u3',
password=u'qweqwe',
email=u'[email protected]',
firstname=u'u3', lastname=u'u3')
Session().commit()
self.u3 = u3.user_id
self.remove_all_notifications()
assert [] == Notification.query().all()
assert [] == UserNotification.query().all()
示例2: test_push_unlocks_repository_git
# 需要导入模块: from kallithea.model.meta import Session [as 别名]
# 或者: from kallithea.model.meta.Session import remove [as 别名]
def test_push_unlocks_repository_git(self, webserver):
# enable locking
fork_name = '%s_fork%s' % (GIT_REPO, _RandomNameSequence().next())
fixture.create_fork(GIT_REPO, fork_name)
r = Repository.get_by_repo_name(fork_name)
r.enable_locking = True
Session().commit()
#clone some temp
DEST = _get_tmp_dir()
clone_url = webserver.repo_url(fork_name)
stdout, stderr = Command(TESTS_TMP_PATH).execute('git clone', clone_url, DEST)
#check for lock repo after clone
r = Repository.get_by_repo_name(fork_name)
assert r.locked[0] == User.get_by_username(TEST_USER_ADMIN_LOGIN).user_id
#push is ok and repo is now unlocked
stdout, stderr = _add_files_and_push(webserver, 'git', DEST, clone_url=clone_url)
_check_proper_git_push(stdout, stderr)
assert ('remote: Released lock on repo `%s`' % fork_name) in stderr
#we need to cleanup the Session Here !
Session.remove()
r = Repository.get_by_repo_name(fork_name)
assert r.locked == [None, None]
示例3: teardown_method
# 需要导入模块: from kallithea.model.meta import Session [as 别名]
# 或者: from kallithea.model.meta.Session import remove [as 别名]
def teardown_method(self, method):
if self.r2_id:
RepoModel().delete(self.r2_id)
if self.r1_id:
RepoModel().delete(self.r1_id)
Session().commit()
Session.remove()
示例4: teardown_method
# 需要导入模块: from kallithea.model.meta import Session [as 别名]
# 或者: from kallithea.model.meta.Session import remove [as 别名]
def teardown_method(self, method):
perm = Permission.query().all()
for p in perm:
UserModel().revoke_perm(self.u1, p)
UserModel().delete(self.u1)
Session().commit()
Session.remove()
示例5: _destroy_project_tree
# 需要导入模块: from kallithea.model.meta import Session [as 别名]
# 或者: from kallithea.model.meta.Session import remove [as 别名]
def _destroy_project_tree(test_u1_id):
Session.remove()
repo_group = RepoGroup.get_by_group_name(group_name='g0')
for el in reversed(repo_group.recursive_groups_and_repos()):
if isinstance(el, Repository):
RepoModel().delete(el)
elif isinstance(el, RepoGroup):
RepoGroupModel().delete(el, force_delete=True)
u = User.get(test_u1_id)
Session().delete(u)
Session().commit()
示例6: teardown_class
# 需要导入模块: from kallithea.model.meta import Session [as 别名]
# 或者: from kallithea.model.meta.Session import remove [as 别名]
def teardown_class(cls):
# delete in reversed order, to delete fork destination at first
for reponame, init_or_fork, groupname in reversed(repos):
RepoModel().delete(repoids[reponame])
for reponame, init_or_fork, groupname in reversed(repos):
if groupname in groupids:
RepoGroupModel().delete(groupids.pop(groupname),
force_delete=True)
Session().commit()
Session.remove()
rebuild_index(full_index=True) # rebuild fully for subsequent tests
示例7: set_available_permissions
# 需要导入模块: from kallithea.model.meta import Session [as 别名]
# 或者: from kallithea.model.meta.Session import remove [as 别名]
def set_available_permissions(config):
"""
This function will propagate globals with all available defined
permission given in db. We don't want to check each time from db for new
permissions since adding a new permission also requires application restart
ie. to decorate new views with the newly created permission
:param config: current config instance
"""
log.info('getting information about all available permissions')
try:
all_perms = Session().query(Permission).all()
config['available_permissions'] = [x.permission_name for x in all_perms]
finally:
Session.remove()
示例8: test_push_unlocks_repository_hg
# 需要导入模块: from kallithea.model.meta import Session [as 别名]
# 或者: from kallithea.model.meta.Session import remove [as 别名]
def test_push_unlocks_repository_hg(self):
# enable locking
r = Repository.get_by_repo_name(HG_REPO)
r.enable_locking = True
Session().add(r)
Session().commit()
#clone some temp
DEST = _get_tmp_dir()
clone_url = _construct_url(HG_REPO, dest=DEST)
stdout, stderr = Command('/tmp').execute('hg clone', clone_url)
#check for lock repo after clone
r = Repository.get_by_repo_name(HG_REPO)
uid = User.get_by_username(TEST_USER_ADMIN_LOGIN).user_id
assert r.locked[0] == uid
#push is ok and repo is now unlocked
stdout, stderr = _add_files_and_push('hg', DEST)
assert ('remote: Released lock on repo `%s`' % HG_REPO) in stdout
#we need to cleanup the Session Here !
Session.remove()
r = Repository.get_by_repo_name(HG_REPO)
assert r.locked == [None, None]
示例9: __init__
# 需要导入模块: from kallithea.model.meta import Session [as 别名]
# 或者: from kallithea.model.meta.Session import remove [as 别名]
def __init__(self, methodName='runTest'):
Session.remove()
self.u1 = UserModel().create_or_update(username=u'u1',
password=u'qweqwe',
email=u'[email protected]',
firstname=u'u1', lastname=u'u1')
Session().commit()
self.u1 = self.u1.user_id
self.u2 = UserModel().create_or_update(username=u'u2',
password=u'qweqwe',
email=u'[email protected]',
firstname=u'u2', lastname=u'u3')
Session().commit()
self.u2 = self.u2.user_id
self.u3 = UserModel().create_or_update(username=u'u3',
password=u'qweqwe',
email=u'[email protected]',
firstname=u'u3', lastname=u'u3')
Session().commit()
self.u3 = self.u3.user_id
super(TestNotifications, self).__init__(methodName=methodName)
示例10: setup_class
# 需要导入模块: from kallithea.model.meta import Session [as 别名]
# 或者: from kallithea.model.meta.Session import remove [as 别名]
def setup_class(cls):
Session.remove()
示例11: tearDown
# 需要导入模块: from kallithea.model.meta import Session [as 别名]
# 或者: from kallithea.model.meta.Session import remove [as 别名]
def tearDown(self):
fixture.destroy_repo('main')
Session.commit()
Session.remove()
示例12: __init__
# 需要导入模块: from kallithea.model.meta import Session [as 别名]
# 或者: from kallithea.model.meta.Session import remove [as 别名]
def __init__(self, methodName='runTest'):
Session.remove()
super(TestUser, self).__init__(methodName=methodName)