@@ -28,7 +28,8 @@ var API_ENDPOINT = process.env.API_ENDPOINT || 'http://localhost:8080',
28
28
USER = {
29
29
heffan : "ad|132456" ,
30
30
"super" : "ad|132457" ,
31
- user : "ad|132458"
31
+ user : "ad|132458" ,
32
+ ksmith : "ad|124861" // web arena super user
32
33
} ;
33
34
34
35
@@ -168,14 +169,18 @@ describe('SRM Round Components And Terms APIs', function () {
168
169
assertPostError ( "/v2/data/srm/rounds/13673/components" , null , validRequest , 401 , "Authorized information needed." , done ) ;
169
170
} ) ;
170
171
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 ) ;
173
174
} ) ;
174
175
175
176
it ( "roundId should be number." , function ( done ) {
176
177
assertPostError ( "/v2/data/srm/rounds/13673a/components" , 'heffan' , validRequest , 400 , "roundId should be number." , done ) ;
177
178
} ) ;
178
179
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
+
179
184
it ( "roundId should be Integer." , function ( done ) {
180
185
assertPostError ( "/v2/data/srm/rounds/13673.01/components" , 'heffan' , validRequest , 400 , "roundId should be Integer." , done ) ;
181
186
} ) ;
@@ -195,46 +200,46 @@ describe('SRM Round Components And Terms APIs', function () {
195
200
"components should be Array." , done ) ;
196
201
} ) ;
197
202
198
- it ( "componentId should not be null or undefined " , function ( done ) {
203
+ it ( "componentId should be provided " , function ( done ) {
199
204
validRequest = { "components" : [ { "componentId" : 2020 , "points" : 1 , "divisionId" : 1 , "difficultyId" : 1 , "openOrder" : 1 , "submitOrder" : 1 } ,
200
205
{ "points" : 1 , "divisionId" : 1 , "difficultyId" : 1 , "openOrder" : 1 , "submitOrder" : 1 } ] } ;
201
206
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 ) ;
203
208
} ) ;
204
209
205
- it ( "points should not be null or undefined " , function ( done ) {
210
+ it ( "points should be provided " , function ( done ) {
206
211
validRequest = { "components" : [ { "componentId" : 2020 , "points" : 1 , "divisionId" : 1 , "difficultyId" : 1 , "openOrder" : 1 , "submitOrder" : 1 } ,
207
212
{ "componentId" : 2021 , "divisionId" : 1 , "difficultyId" : 1 , "openOrder" : 1 , "submitOrder" : 1 } ] } ;
208
213
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 ) ;
210
215
} ) ;
211
216
212
- it ( "divisionId should not be null or undefined " , function ( done ) {
217
+ it ( "divisionId should be provided " , function ( done ) {
213
218
validRequest = { "components" : [ { "componentId" : 2020 , "points" : 1 , "divisionId" : 1 , "difficultyId" : 1 , "openOrder" : 1 , "submitOrder" : 1 } ,
214
219
{ "componentId" : 2021 , "points" : 1 , "difficultyId" : 1 , "openOrder" : 1 , "submitOrder" : 1 } ] } ;
215
220
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 ) ;
217
222
} ) ;
218
223
219
- it ( "difficultyId should not be null or undefined " , function ( done ) {
224
+ it ( "difficultyId should be provided " , function ( done ) {
220
225
validRequest = { "components" : [ { "componentId" : 2020 , "points" : 1 , "divisionId" : 1 , "difficultyId" : 1 , "openOrder" : 1 , "submitOrder" : 1 } ,
221
226
{ "componentId" : 2021 , "points" : 1 , "divisionId" : 1 , "openOrder" : 1 , "submitOrder" : 1 } ] } ;
222
227
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 ) ;
224
229
} ) ;
225
230
226
- it ( "openOrder should not be null or undefined " , function ( done ) {
231
+ it ( "openOrder should be provided " , function ( done ) {
227
232
validRequest = { "components" : [ { "componentId" : 2020 , "points" : 1 , "divisionId" : 1 , "difficultyId" : 1 , "openOrder" : 1 , "submitOrder" : 1 } ,
228
233
{ "componentId" : 2021 , "points" : 1 , "divisionId" : 1 , "difficultyId" : 1 , "submitOrder" : 1 } ] } ;
229
234
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 ) ;
231
236
} ) ;
232
237
233
- it ( "submitOrder should not be null or undefined " , function ( done ) {
238
+ it ( "submitOrder should be provided " , function ( done ) {
234
239
validRequest = { "components" : [ { "componentId" : 2020 , "points" : 1 , "divisionId" : 1 , "difficultyId" : 1 , "openOrder" : 1 , "submitOrder" : 1 } ,
235
240
{ "componentId" : 2021 , "points" : 1 , "divisionId" : 1 , "difficultyId" : 1 , "openOrder" : 1 } ] } ;
236
241
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 ) ;
238
243
} ) ;
239
244
240
245
it ( "componentId should be positive." , function ( done ) {
@@ -315,14 +320,18 @@ describe('SRM Round Components And Terms APIs', function () {
315
320
assertPostError ( "/v2/data/srm/rounds/13673/terms" , null , validRequest , 401 , "Authorized information needed." , done ) ;
316
321
} ) ;
317
322
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 ) ;
320
325
} ) ;
321
326
322
327
it ( "roundId should be number." , function ( done ) {
323
328
assertPostError ( "/v2/data/srm/rounds/13673a/terms" , 'heffan' , validRequest , 400 , "roundId should be number." , done ) ;
324
329
} ) ;
325
330
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
+
326
335
it ( "roundId should be Integer." , function ( done ) {
327
336
assertPostError ( "/v2/data/srm/rounds/13673.01/terms" , 'heffan' , validRequest , 400 , "roundId should be Integer." , done ) ;
328
337
} ) ;
@@ -476,4 +485,4 @@ describe('SRM Round Components And Terms APIs', function () {
476
485
} ) ;
477
486
} ) ;
478
487
} ) ;
479
- } ) ;
488
+ } ) ;
0 commit comments