##// END OF EJS Templates
db: use more consistent sorting using real objects, strings are deprecated in laters sqlalchemy query syntax.
marcink -
r3949:2da6b4aa default
parent child Browse files
Show More
@@ -49,7 +49,7 b' class TestClosePullRequest(object):'
49 49 assert_ok(id_, expected, response.body)
50 50 journal = UserLog.query()\
51 51 .filter(UserLog.user_id == author) \
52 .order_by('user_log_id') \
52 .order_by(UserLog.user_log_id.asc()) \
53 53 .filter(UserLog.repository_id == repo)\
54 54 .all()
55 55 assert journal[-1].action == 'repo.pull_request.close'
@@ -65,7 +65,7 b' class TestCommentPullRequest(object):'
65 65 journal = UserLog.query()\
66 66 .filter(UserLog.user_id == author)\
67 67 .filter(UserLog.repository_id == repo) \
68 .order_by('user_log_id') \
68 .order_by(UserLog.user_log_id.asc()) \
69 69 .all()
70 70 assert journal[-1].action == 'repo.pull_request.comment.create'
71 71
@@ -120,7 +120,7 b' class TestMergePullRequest(object):'
120 120 journal = UserLog.query()\
121 121 .filter(UserLog.user_id == author)\
122 122 .filter(UserLog.repository_id == repo) \
123 .order_by('user_log_id') \
123 .order_by(UserLog.user_log_id.asc()) \
124 124 .all()
125 125 assert journal[-2].action == 'repo.pull_request.merge'
126 126 assert journal[-1].action == 'repo.pull_request.close'
@@ -221,7 +221,7 b' class TestMergePullRequest(object):'
221 221 journal = UserLog.query() \
222 222 .filter(UserLog.user_id == merge_user_id) \
223 223 .filter(UserLog.repository_id == repo) \
224 .order_by('user_log_id') \
224 .order_by(UserLog.user_log_id.asc()) \
225 225 .all()
226 226 assert journal[-2].action == 'repo.pull_request.merge'
227 227 assert journal[-1].action == 'repo.pull_request.close'
@@ -180,7 +180,7 b' class AdminRepoGroupsView(BaseAppView, D'
180 180 # generate multiple IN to fix limitation problems
181 181 *in_filter_generator(RepoGroup.group_id, allowed_ids)
182 182 )) \
183 .outerjoin(Repository) \
183 .outerjoin(Repository, Repository.group_id == RepoGroup.group_id) \
184 184 .join(User, User.user_id == RepoGroup.user_id) \
185 185 .group_by(RepoGroup, User)
186 186
@@ -134,7 +134,7 b' class AdminUserGroupsView(BaseAppView, D'
134 134 # generate multiple IN to fix limitation problems
135 135 *in_filter_generator(UserGroup.users_group_id, allowed_ids)
136 136 )) \
137 .outerjoin(UserGroupMember) \
137 .outerjoin(UserGroupMember, UserGroupMember.users_group_id == UserGroup.users_group_id) \
138 138 .join(User, User.user_id == UserGroup.user_id) \
139 139 .group_by(UserGroup, User)
140 140
@@ -284,7 +284,7 b' class TestPullrequestsView(object):'
284 284 journal = UserLog.query()\
285 285 .filter(UserLog.user_id == author)\
286 286 .filter(UserLog.repository_id == repo) \
287 .order_by('user_log_id') \
287 .order_by(UserLog.user_log_id.asc()) \
288 288 .all()
289 289 assert journal[-1].action == 'repo.pull_request.close'
290 290
@@ -323,7 +323,7 b' class TestPullrequestsView(object):'
323 323
324 324 journal = UserLog.query()\
325 325 .filter(UserLog.user_id == author, UserLog.repository_id == repo) \
326 .order_by('user_log_id') \
326 .order_by(UserLog.user_log_id.asc()) \
327 327 .all()
328 328 assert journal[-1].action == 'repo.pull_request.close'
329 329
@@ -563,7 +563,7 b' class TestPullrequestsView(object):'
563 563 pull_request, ChangesetStatus.STATUS_APPROVED)
564 564
565 565 # Check the relevant log entries were added
566 user_logs = UserLog.query().order_by('-user_log_id').limit(3)
566 user_logs = UserLog.query().order_by(UserLog.user_log_id.desc()).limit(3)
567 567 actions = [log.action for log in user_logs]
568 568 pr_commit_ids = PullRequestModel()._get_commit_ids(pull_request)
569 569 expected_actions = [
@@ -573,7 +573,7 b' class TestPullrequestsView(object):'
573 573 ]
574 574 assert actions == expected_actions
575 575
576 user_logs = UserLog.query().order_by('-user_log_id').limit(4)
576 user_logs = UserLog.query().order_by(UserLog.user_log_id.desc()).limit(4)
577 577 actions = [log for log in user_logs]
578 578 assert actions[-1].action == 'user.push'
579 579 assert actions[-1].action_data['commit_ids'] == pr_commit_ids
@@ -48,7 +48,7 b' def test_post_push_truncates_commits(use'
48 48 # Calculate appropriate action string here
49 49 commit_ids = extras.commit_ids[:400]
50 50
51 entry = UserLog.query().order_by('-user_log_id').first()
51 entry = UserLog.query().order_by(UserLog.user_log_id.desc()).first()
52 52 assert entry.action == 'user.push'
53 53 assert entry.action_data['commit_ids'] == commit_ids
54 54 Session().delete(entry)
@@ -149,3 +149,4 b' def test_hooks_propagates_not_on_shadow('
149 149 # Assert that extensions are *not* called and event was *not* fired.
150 150 assert not extension_mock.called
151 151 assert not events_mock.trigger.called
152
General Comments 0
You need to be logged in to leave comments. Login now