Skip to content

Commit 80ef2ab

Browse files
committed
test: add testPush logging to debug CI test execution
1 parent f97c038 commit 80ef2ab

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/service/routes/push.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,13 +110,17 @@ router.post('/:id/authorise', async (req: Request, res: Response) => {
110110
console.log({ list });
111111

112112
if (list.length === 0) {
113+
console.log(
114+
`/api/v1/push/${id}/authorise: There was no registered user with the committer's email address: ${committerEmail}`,
115+
);
113116
res.status(401).send({
114117
message: `There was no registered user with the committer's email address: ${committerEmail}`,
115118
});
116119
return;
117120
}
118121

119122
if (list[0].username.toLowerCase() === username.toLowerCase() && !list[0].admin) {
123+
console.log(`/api/v1/push/${id}/authorise: Cannot approve your own changes`);
120124
res.status(401).send({
121125
message: `Cannot approve your own changes`,
122126
});
@@ -126,6 +130,7 @@ router.post('/:id/authorise', async (req: Request, res: Response) => {
126130
// If we are not the author, now check that we are allowed to authorise on this repo
127131
const isAllowed = await db.canUserApproveRejectPush(id, username);
128132
if (!isAllowed) {
133+
console.log(`/api/v1/push/${id}/authorise: User is not authorised to authorise changes`);
129134
res.status(401).send({
130135
message: 'User is not authorised to authorise changes',
131136
});
@@ -141,6 +146,9 @@ router.post('/:id/authorise', async (req: Request, res: Response) => {
141146
console.log({ reviewerGitAccount });
142147

143148
if (!reviewerGitAccount) {
149+
console.log(
150+
`/api/v1/push/${id}/authorise: You must associate a GitHub account with your user before approving...`,
151+
);
144152
res.status(401).send({
145153
message: 'You must associate a GitHub account with your user before approving...',
146154
});
@@ -158,6 +166,7 @@ router.post('/:id/authorise', async (req: Request, res: Response) => {
158166
const result = await db.authorise(id, attestation);
159167
res.send(result);
160168
} else {
169+
console.log(`/api/v1/push/:id/authorise: You are unauthorized to perform this action...`);
161170
res.status(401).send({
162171
message: 'You are unauthorized to perform this action...',
163172
});

0 commit comments

Comments
 (0)