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