@@ -28,7 +28,8 @@ var API_ENDPOINT = process.env.API_ENDPOINT || 'http://localhost:8080',
2828 USER = {
2929 heffan : "ad|132456" ,
3030 "super" : "ad|132457" ,
31- user : "ad|132458"
31+ user : "ad|132458" ,
32+ ksmith : "ad|124861" // web arena super user
3233 } ;
3334
3435
@@ -168,14 +169,18 @@ describe('SRM Round Components And Terms APIs', function () {
168169 assertPostError ( "/v2/data/srm/rounds/13673/components" , null , validRequest , 401 , "Authorized information needed." , done ) ;
169170 } ) ;
170171
171- it ( "Admin access only." , function ( done ) {
172- assertPostError ( "/v2/data/srm/rounds/13673/components" , 'user' , validRequest , 403 , "Admin access only." , done ) ;
172+ it ( "Admin or web Arena super user only." , function ( done ) {
173+ assertPostError ( "/v2/data/srm/rounds/13673/components" , 'user' , validRequest , 403 , "Admin or web Arena super user only." , done ) ;
173174 } ) ;
174175
175176 it ( "roundId should be number." , function ( done ) {
176177 assertPostError ( "/v2/data/srm/rounds/13673a/components" , 'heffan' , validRequest , 400 , "roundId should be number." , done ) ;
177178 } ) ;
178179
180+ it ( "roundId should be number (with web Arena super user)." , function ( done ) {
181+ assertPostError ( "/v2/data/srm/rounds/13673a/components" , 'ksmith' , validRequest , 400 , "roundId should be number." , done ) ;
182+ } ) ;
183+
179184 it ( "roundId should be Integer." , function ( done ) {
180185 assertPostError ( "/v2/data/srm/rounds/13673.01/components" , 'heffan' , validRequest , 400 , "roundId should be Integer." , done ) ;
181186 } ) ;
@@ -195,46 +200,46 @@ describe('SRM Round Components And Terms APIs', function () {
195200 "components should be Array." , done ) ;
196201 } ) ;
197202
198- it ( "componentId should not be null or undefined " , function ( done ) {
203+ it ( "componentId should be provided " , function ( done ) {
199204 validRequest = { "components" : [ { "componentId" : 2020 , "points" : 1 , "divisionId" : 1 , "difficultyId" : 1 , "openOrder" : 1 , "submitOrder" : 1 } ,
200205 { "points" : 1 , "divisionId" : 1 , "difficultyId" : 1 , "openOrder" : 1 , "submitOrder" : 1 } ] } ;
201206 assertPostError ( "/v2/data/srm/rounds/13673/components" , 'heffan' , validRequest , 400 ,
202- "componentId should not be null or undefined " , done ) ;
207+ "componentId should be provided " , done ) ;
203208 } ) ;
204209
205- it ( "points should not be null or undefined " , function ( done ) {
210+ it ( "points should be provided " , function ( done ) {
206211 validRequest = { "components" : [ { "componentId" : 2020 , "points" : 1 , "divisionId" : 1 , "difficultyId" : 1 , "openOrder" : 1 , "submitOrder" : 1 } ,
207212 { "componentId" : 2021 , "divisionId" : 1 , "difficultyId" : 1 , "openOrder" : 1 , "submitOrder" : 1 } ] } ;
208213 assertPostError ( "/v2/data/srm/rounds/13673/components" , 'heffan' , validRequest , 400 ,
209- "points should not be null or undefined " , done ) ;
214+ "points should be provided " , done ) ;
210215 } ) ;
211216
212- it ( "divisionId should not be null or undefined " , function ( done ) {
217+ it ( "divisionId should be provided " , function ( done ) {
213218 validRequest = { "components" : [ { "componentId" : 2020 , "points" : 1 , "divisionId" : 1 , "difficultyId" : 1 , "openOrder" : 1 , "submitOrder" : 1 } ,
214219 { "componentId" : 2021 , "points" : 1 , "difficultyId" : 1 , "openOrder" : 1 , "submitOrder" : 1 } ] } ;
215220 assertPostError ( "/v2/data/srm/rounds/13673/components" , 'heffan' , validRequest , 400 ,
216- "divisionId should not be null or undefined " , done ) ;
221+ "divisionId should be provided " , done ) ;
217222 } ) ;
218223
219- it ( "difficultyId should not be null or undefined " , function ( done ) {
224+ it ( "difficultyId should be provided " , function ( done ) {
220225 validRequest = { "components" : [ { "componentId" : 2020 , "points" : 1 , "divisionId" : 1 , "difficultyId" : 1 , "openOrder" : 1 , "submitOrder" : 1 } ,
221226 { "componentId" : 2021 , "points" : 1 , "divisionId" : 1 , "openOrder" : 1 , "submitOrder" : 1 } ] } ;
222227 assertPostError ( "/v2/data/srm/rounds/13673/components" , 'heffan' , validRequest , 400 ,
223- "difficultyId should not be null or undefined " , done ) ;
228+ "difficultyId should be provided " , done ) ;
224229 } ) ;
225230
226- it ( "openOrder should not be null or undefined " , function ( done ) {
231+ it ( "openOrder should be provided " , function ( done ) {
227232 validRequest = { "components" : [ { "componentId" : 2020 , "points" : 1 , "divisionId" : 1 , "difficultyId" : 1 , "openOrder" : 1 , "submitOrder" : 1 } ,
228233 { "componentId" : 2021 , "points" : 1 , "divisionId" : 1 , "difficultyId" : 1 , "submitOrder" : 1 } ] } ;
229234 assertPostError ( "/v2/data/srm/rounds/13673/components" , 'heffan' , validRequest , 400 ,
230- "openOrder should not be null or undefined " , done ) ;
235+ "openOrder should be provided " , done ) ;
231236 } ) ;
232237
233- it ( "submitOrder should not be null or undefined " , function ( done ) {
238+ it ( "submitOrder should be provided " , function ( done ) {
234239 validRequest = { "components" : [ { "componentId" : 2020 , "points" : 1 , "divisionId" : 1 , "difficultyId" : 1 , "openOrder" : 1 , "submitOrder" : 1 } ,
235240 { "componentId" : 2021 , "points" : 1 , "divisionId" : 1 , "difficultyId" : 1 , "openOrder" : 1 } ] } ;
236241 assertPostError ( "/v2/data/srm/rounds/13673/components" , 'heffan' , validRequest , 400 ,
237- "submitOrder should not be null or undefined " , done ) ;
242+ "submitOrder should be provided " , done ) ;
238243 } ) ;
239244
240245 it ( "componentId should be positive." , function ( done ) {
@@ -315,14 +320,18 @@ describe('SRM Round Components And Terms APIs', function () {
315320 assertPostError ( "/v2/data/srm/rounds/13673/terms" , null , validRequest , 401 , "Authorized information needed." , done ) ;
316321 } ) ;
317322
318- it ( "Admin access only." , function ( done ) {
319- assertPostError ( "/v2/data/srm/rounds/13673/terms" , 'user' , validRequest , 403 , "Admin access only." , done ) ;
323+ it ( "Admin or web Arena super user only." , function ( done ) {
324+ assertPostError ( "/v2/data/srm/rounds/13673/terms" , 'user' , validRequest , 403 , "Admin or web Arena super user only." , done ) ;
320325 } ) ;
321326
322327 it ( "roundId should be number." , function ( done ) {
323328 assertPostError ( "/v2/data/srm/rounds/13673a/terms" , 'heffan' , validRequest , 400 , "roundId should be number." , done ) ;
324329 } ) ;
325330
331+ it ( "roundId should be number (with web Arena super user)." , function ( done ) {
332+ assertPostError ( "/v2/data/srm/rounds/13673a/terms" , 'ksmith' , validRequest , 400 , "roundId should be number." , done ) ;
333+ } ) ;
334+
326335 it ( "roundId should be Integer." , function ( done ) {
327336 assertPostError ( "/v2/data/srm/rounds/13673.01/terms" , 'heffan' , validRequest , 400 , "roundId should be Integer." , done ) ;
328337 } ) ;
@@ -476,4 +485,4 @@ describe('SRM Round Components And Terms APIs', function () {
476485 } ) ;
477486 } ) ;
478487 } ) ;
479- } ) ;
488+ } ) ;
0 commit comments