@@ -30,7 +30,7 @@ var API_ENDPOINT = process.env.API_ENDPOINT || 'http://localhost:8080',
3030 heffan : "ad|132456" ,
3131 "super" : "ad|132457" ,
3232 user : "ad|132458" ,
33- ksmith : "ad|124861"
33+ ksmith : "ad|124861" // web arena super user
3434 } ;
3535
3636
@@ -70,7 +70,7 @@ function createRequest(queryString, user) {
7070 */
7171function createPostRequest ( queryString , user ) {
7272 var req = request ( API_ENDPOINT )
73- . put ( queryString )
73+ . post ( queryString )
7474 . set ( "Accept" , "application/json" )
7575 . expect ( "Content-Type" , / j s o n / ) ;
7676 if ( user ) {
@@ -222,14 +222,18 @@ describe('SRM Round Questions APIs', function () {
222222 assertError ( "/v2/data/srm/rounds/13673/questions" , null , 401 , "Authorized information needed." , done ) ;
223223 } ) ;
224224
225- it ( "Admin access only." , function ( done ) {
226- assertError ( "/v2/data/srm/rounds/13673/questions" , 'user' , 403 , "Admin access only." , done ) ;
225+ it ( "Admin or web Arena super user only." , function ( done ) {
226+ assertError ( "/v2/data/srm/rounds/13673/questions" , 'user' , 403 , "Admin or web Arena super user only." , done ) ;
227227 } ) ;
228228
229229 it ( "roundId should be number." , function ( done ) {
230230 assertError ( "/v2/data/srm/rounds/roundId/questions" , 'heffan' , 400 , "roundId should be number." , done ) ;
231231 } ) ;
232232
233+ it ( "roundId should be number (with web Arena super user)." , function ( done ) {
234+ assertError ( "/v2/data/srm/rounds/roundId/questions" , 'ksmith' , 400 , "roundId should be number." , done ) ;
235+ } ) ;
236+
233237 it ( "roundId should be Integer." , function ( done ) {
234238 assertError ( "/v2/data/srm/rounds/13673.01/questions" , 'heffan' , 400 , "roundId should be Integer." , done ) ;
235239 } ) ;
@@ -255,12 +259,11 @@ describe('SRM Round Questions APIs', function () {
255259 assertError ( "/v2/data/srm/rounds/1000000/answers" , 'user' , 403 , "Admin or web Arena super user only." , done ) ;
256260 } ) ;
257261
258- // Only admin or web arena super user can get into this step
259262 it ( "questionId should be number." , function ( done ) {
260263 assertError ( "/v2/data/srm/rounds/aaa/answers" , 'heffan' , 400 , "questionId should be number." , done ) ;
261264 } ) ;
262265
263- it ( "questionId should be number." , function ( done ) {
266+ it ( "questionId should be number (with web Arena super user) ." , function ( done ) {
264267 assertError ( "/v2/data/srm/rounds/aaa/answers" , 'ksmith' , 400 , "questionId should be number." , done ) ;
265268 } ) ;
266269
@@ -399,12 +402,11 @@ describe('SRM Round Questions APIs', function () {
399402 assertPostError ( "/v2/data/srm/questions/306/answers" , 'user' , validRequest , 403 , "Admin or web Arena super user only." , done ) ;
400403 } ) ;
401404
402- // Only admin or web arena super user can get into this step
403405 it ( "questionId should be number." , function ( done ) {
404406 assertPostError ( "/v2/data/srm/questions/aaa/answers" , 'heffan' , validRequest , 400 , "questionId should be number." , done ) ;
405407 } ) ;
406408
407- it ( "questionId should be number." , function ( done ) {
409+ it ( "questionId should be number (with web Arena super user) ." , function ( done ) {
408410 assertPostError ( "/v2/data/srm/questions/aaa/answers" , 'ksmith' , validRequest , 400 , "questionId should be number." , done ) ;
409411 } ) ;
410412
@@ -469,9 +471,11 @@ describe('SRM Round Questions APIs', function () {
469471 assertPostError ( "/v2/data/srm/rounds/13673/questions" , 'user' , validRequest , 403 , "Admin or web Arena super user only." , done ) ;
470472 } ) ;
471473
472- // Only admin or web arena super user can get into this step
473474 it ( "roundId should be number." , function ( done ) {
474475 assertPostError ( "/v2/data/srm/rounds/aaa/questions" , 'heffan' , validRequest , 400 , "roundId should be number." , done ) ;
476+ } ) ;
477+
478+ it ( "roundId should be number (with web Arena super user)." , function ( done ) {
475479 assertPostError ( "/v2/data/srm/rounds/aaa/questions" , 'ksmith' , validRequest , 400 , "roundId should be number." , done ) ;
476480 } ) ;
477481
@@ -587,14 +591,18 @@ describe('SRM Round Questions APIs', function () {
587591 assertPostError ( "/v2/data/srm/rounds/306/question" , null , validRequest , 401 , "Authorized information needed." , done ) ;
588592 } ) ;
589593
590- it ( "Admin access only." , function ( done ) {
591- assertPostError ( "/v2/data/srm/rounds/306/question" , 'user' , validRequest , 403 , "Admin access only." , done ) ;
594+ it ( "Admin or web Arena super user only." , function ( done ) {
595+ assertPostError ( "/v2/data/srm/rounds/306/question" , 'user' , validRequest , 403 , "Admin or web Arena super user only." , done ) ;
592596 } ) ;
593597
594598 it ( "questionId should be number." , function ( done ) {
595599 assertPostError ( "/v2/data/srm/rounds/aaa/question" , 'heffan' , validRequest , 400 , "questionId should be number." , done ) ;
596600 } ) ;
597601
602+ it ( "questionId should be number (with web Arena super user)." , function ( done ) {
603+ assertPostError ( "/v2/data/srm/rounds/aaa/question" , 'ksmith' , validRequest , 400 , "questionId should be number." , done ) ;
604+ } ) ;
605+
598606 it ( "questionId should be Integer." , function ( done ) {
599607 assertPostError ( "/v2/data/srm/rounds/30.6/question" , 'heffan' , validRequest , 400 , "questionId should be Integer." , done ) ;
600608 } ) ;
@@ -697,14 +705,18 @@ describe('SRM Round Questions APIs', function () {
697705 assertDeleteError ( "/v2/data/srm/rounds/306/question" , null , 401 , "Authorized information needed." , done ) ;
698706 } ) ;
699707
700- it ( "Admin access only." , function ( done ) {
701- assertDeleteError ( "/v2/data/srm/rounds/306/question" , 'user' , 403 , "Admin access only." , done ) ;
708+ it ( "Admin or web Arena super user only." , function ( done ) {
709+ assertDeleteError ( "/v2/data/srm/rounds/306/question" , 'user' , 403 , "Admin or web Arena super user only." , done ) ;
702710 } ) ;
703711
704712 it ( "questionId should be number." , function ( done ) {
705713 assertDeleteError ( "/v2/data/srm/rounds/aaa/question" , 'heffan' , 400 , "questionId should be number." , done ) ;
706714 } ) ;
707715
716+ it ( "questionId should be number (with web Arena super user)." , function ( done ) {
717+ assertDeleteError ( "/v2/data/srm/rounds/aaa/question" , 'ksmith' , 400 , "questionId should be number." , done ) ;
718+ } ) ;
719+
708720 it ( "questionId should be Integer." , function ( done ) {
709721 assertDeleteError ( "/v2/data/srm/rounds/30.6/question" , 'heffan' , 400 , "questionId should be Integer." , done ) ;
710722 } ) ;
0 commit comments