Skip to content

Commit 6d07779

Browse files
committed
see ubccpsc#31 fix tests (was too aggressive on the log outputs)
1 parent b5586ca commit 6d07779

File tree

5 files changed

+20
-12
lines changed

5 files changed

+20
-12
lines changed

packages/portal/backend/src/controllers/DatabaseController.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -198,22 +198,22 @@ export class DatabaseController {
198198
*/
199199

200200
public async deleteAuth(record: Auth): Promise<boolean> {
201-
Log.info("DatabaseController::deleteAuth( "+record.personId+" ) - start");
202201
if (record !== null) {
202+
Log.info("DatabaseController::deleteAuth( " + record.personId + " ) - start");
203203
return await this.deleteRecord(this.AUTHCOLL, {personId: record.personId});
204204
}
205205
}
206206

207207
public async deleteRepository(record: Repository): Promise<boolean> {
208-
Log.info("DatabaseController::deleteRepository( "+record.id+" ) - start");
209208
if (record !== null) {
209+
Log.info("DatabaseController::deleteRepository( " + record.id + " ) - start");
210210
return await this.deleteRecord(this.REPOCOLL, {id: record.id});
211211
}
212212
}
213213

214214
public async deleteTeam(record: Team): Promise<boolean> {
215-
Log.info("DatabaseController::deleteTeam( "+record.id+" ) - start");
216215
if (record !== null) {
216+
Log.info("DatabaseController::deleteTeam( " + record.id + " ) - start");
217217
return await this.deleteRecord(this.TEAMCOLL, {id: record.id});
218218
}
219219
}

packages/portal/backend/src/controllers/PersonController.ts

+1
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ export class PersonController {
6767
* @returns {boolean}
6868
*/
6969
public async getPerson(personId: string): Promise<Person | null> {
70+
Log.trace("PersonController::getPerson( ... ) - start");
7071
Log.trace("PersonController::getPerson( " + personId + " ) - start");
7172

7273
let person = await this.db.getPerson(personId);

packages/portal/backend/src/server/common/AuthRoutes.ts

+8-4
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,10 @@ export class AuthRoutes implements IREST {
143143
handleError("Login error; user not valid.");
144144
}
145145
}).then(function (isPrivileged) {
146+
if (typeof isPrivileged === 'undefined') {
147+
Log.warn('RouteHandler::getCredentials(..) - failsafe; DEBUG this case?');
148+
isPrivileged = {isAdmin: false, isStaff: false}; // fail safe
149+
}
146150
payload = {success: {personId: user, token: token, isAdmin: isPrivileged.isAdmin, isStaff: isPrivileged.isStaff}};
147151
Log.info('RouteHandler::getCredentials(..) - sending 200; isPriv: ' + (isPrivileged.isStaff || isPrivileged.isAdmin));
148152
res.send(200, payload);
@@ -267,7 +271,7 @@ export class AuthRoutes implements IREST {
267271
// auth written (or not); we only really care about the state of p at this point
268272

269273

270-
Log.info("AuthRouteHandler::authCallback(..) - preparing redirect for: " + JSON.stringify(p));
274+
Log.info("AuthRoutes::authCallback(..) - preparing redirect for: " + JSON.stringify(p));
271275
let feUrl = config.getProp(ConfigKey.backendUrl);
272276
let fePort = config.getProp(ConfigKey.backendPort);
273277

@@ -279,7 +283,7 @@ export class AuthRoutes implements IREST {
279283
if (feUrl.indexOf('//') > 0) {
280284
feUrl = feUrl.substr(feUrl.indexOf('//') + 2, feUrl.length);
281285
}
282-
Log.trace("RouteHandler::authCallback(..) - /authCallback - redirect homepage URL: " + feUrl);
286+
Log.trace("AuthRoutes::authCallback(..) - /authCallback - redirect homepage URL: " + feUrl);
283287

284288
res.redirect({
285289
hostname: feUrl,
@@ -289,7 +293,7 @@ export class AuthRoutes implements IREST {
289293
}, next);
290294
} else {
291295

292-
Log.trace("RouteHandler::authCallback(..) - /authCallback - redirect logout URL: " + feUrl);
296+
Log.trace("AuthRoutes::authCallback(..) - /authCallback - redirect logout URL: " + feUrl);
293297

294298
res.redirect({
295299
hostname: feUrl,
@@ -299,7 +303,7 @@ export class AuthRoutes implements IREST {
299303
}
300304
}).catch(function (err) {
301305
// code incorrect or expired
302-
Log.error("AuthRouteHandler::authCallback(..) - /authCallback - ERROR: " + err);
306+
Log.error("AuthRoutes::authCallback(..) - /authCallback - ERROR: " + err);
303307
// NOTE: should this be returning 400 or something?
304308
return next();
305309
});

packages/portal/backend/test/server/SDMMRoutesSpec.ts

-1
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,6 @@ describe('SDMM Routes', function () {
183183
}).timeout(1000 * 30);
184184

185185
it('Should provision a d0 repo.', async function () {
186-
187186
let response = null;
188187
const url = '/portal/sdmm/performAction/provisionD0';
189188
try {

testOutput/index.html

+8-4
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,14 @@
33
<title>Classy CI Artifacts</title>
44
</head>
55
<body style="font-size: 2em;">
6+
67
<!-- These resources are created by the CI environment and are not actually checked into version control -->
7-
<br/><a href="backend/test/index.html">Backend Test Results</a>
8-
<br/><a href="backend/coverage/index.html">Backend Coverage Report</a>
9-
<br/><a href="autotest/test/index.html">Autotest Test Results</a>
10-
<br/><a href="autotest/coverage/index.html">Autotest Coverage Report</a>
8+
<center>
9+
<h2>Classy CI Artifacts</h2>
10+
<a href="backend/test/index.html">Backend Test Results</a>
11+
<br/><a href="backend/coverage/index.html">Backend Coverage Report</a>
12+
<br/><a href="autotest/test/index.html">Autotest Test Results</a>
13+
<br/><a href="autotest/coverage/index.html">Autotest Coverage Report</a>
14+
</center>
1115
</body>
1216
</html>

0 commit comments

Comments
 (0)