|
1 | 1 | /* |
2 | 2 | * Copyright (C) 2014 TopCoder Inc., All Rights Reserved. |
3 | 3 | * |
4 | | - * @version 1.0 |
5 | | - * @author TCASSEMBLER |
| 4 | + * @version 1.1 |
| 5 | + * @author TCASSEMBLER, TCSFINALFIXER |
| 6 | + * |
| 7 | + * Changes in 1.1: |
| 8 | + * - Add test 'should create new round for web arena super role' |
6 | 9 | */ |
7 | 10 | "use strict"; |
8 | 11 | /*global describe, it, before, beforeEach, after, afterEach */ |
@@ -1328,9 +1331,53 @@ describe('SRM Round Management APIs', function () { |
1328 | 1331 | } |
1329 | 1332 | ], done); |
1330 | 1333 | }); |
1331 | | - }); |
1332 | | - |
1333 | 1334 |
|
| 1335 | + it('should create new round for web arena super role', function (done) { |
| 1336 | + async.waterfall([ |
| 1337 | + _.bind(testHelper.runSqlSelectQuery, testHelper, GET_ROUND_SEQ_SQL, "informixoltp"), |
| 1338 | + function (results, cb) { |
| 1339 | + var roundId = results[0].next_id + 1, |
| 1340 | + req = _.clone(goodRequest), |
| 1341 | + jwt = testHelper.generateAuthHeader({sub: 'ad|124861'}); |
| 1342 | + request(API_ENDPOINT) |
| 1343 | + .post('/v2/data/srm/rounds') |
| 1344 | + .set('Accept', 'application/json') |
| 1345 | + .set('Content-Type', 'application/json') |
| 1346 | + .set('Authorization', jwt) |
| 1347 | + .expect('Content-Type', /json/) |
| 1348 | + .expect(200) |
| 1349 | + .send(req) |
| 1350 | + .end(function (err, res) { |
| 1351 | + if (err) { |
| 1352 | + return cb(err); |
| 1353 | + } |
| 1354 | + assert.equal(res.body.roundId, roundId); |
| 1355 | + testHelper.runSqlSelectQuery( |
| 1356 | + "creator_id, round_type_id from round where round_id = " + roundId, |
| 1357 | + "informixoltp", |
| 1358 | + function (error, results) { |
| 1359 | + if (error) { |
| 1360 | + return cb(error); |
| 1361 | + } |
| 1362 | + assert.ok(results && results.length === 1, "query should have succeeded."); |
| 1363 | + assert.equal( |
| 1364 | + results[0].creator_id, |
| 1365 | + 124861, |
| 1366 | + "creator should be ksmith" |
| 1367 | + ); |
| 1368 | + assert.equal( |
| 1369 | + results[0].round_type_id, |
| 1370 | + 24, |
| 1371 | + "round type should be 'Instant Match'" |
| 1372 | + ); |
| 1373 | + return cb(); |
| 1374 | + } |
| 1375 | + ); |
| 1376 | + }); |
| 1377 | + } |
| 1378 | + ], done); |
| 1379 | + }); |
| 1380 | + }); |
1334 | 1381 | }); |
1335 | 1382 |
|
1336 | 1383 | describe("Modify SRM Contest Round", function () { |
|
0 commit comments