Skip to content

Commit 21060cc

Browse files
committed
REST: Add 403 response spec test for all edit routes
Bug: T375067 Change-Id: I5666051757a2f30c253decbf88f65b2f97008c9b
1 parent 4f94c26 commit 21060cc

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
'use strict';
2+
3+
const { describeWithTestData } = require( '../helpers/describeWithTestData' );
4+
const {
5+
getItemEditRequests,
6+
getPropertyEditRequests,
7+
getItemCreateRequest
8+
} = require( '../helpers/happyPathRequestBuilders' );
9+
const { expect } = require( '../helpers/chaiHelper' );
10+
describeWithTestData( '403 for all edit routes', ( itemRequestInputs, propertyRequestInputs ) => {
11+
[
12+
...getItemEditRequests( itemRequestInputs ),
13+
...getPropertyEditRequests( propertyRequestInputs ),
14+
getItemCreateRequest( itemRequestInputs )
15+
].forEach( ( { newRequestBuilder } ) => {
16+
it( `${newRequestBuilder().getRouteDescription()} responds with a valid 403 response`, async () => {
17+
const response = await newRequestBuilder()
18+
.withJsonBodyParam( 'bot', true )
19+
.makeRequest();
20+
21+
expect( response ).to.have.status( 403 );
22+
expect( response ).to.satisfyApiSpec;
23+
} );
24+
} );
25+
} );

0 commit comments

Comments
 (0)