Skip to content

Commit

Permalink
REST: Add 403 response spec test for all edit routes
Browse files Browse the repository at this point in the history
Bug: T375067
Change-Id: I5666051757a2f30c253decbf88f65b2f97008c9b
  • Loading branch information
jakobw committed Sep 20, 2024
1 parent 4f94c26 commit 21060cc
Showing 1 changed file with 25 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
'use strict';

const { describeWithTestData } = require( '../helpers/describeWithTestData' );
const {
getItemEditRequests,
getPropertyEditRequests,
getItemCreateRequest
} = require( '../helpers/happyPathRequestBuilders' );
const { expect } = require( '../helpers/chaiHelper' );
describeWithTestData( '403 for all edit routes', ( itemRequestInputs, propertyRequestInputs ) => {
[
...getItemEditRequests( itemRequestInputs ),
...getPropertyEditRequests( propertyRequestInputs ),
getItemCreateRequest( itemRequestInputs )
].forEach( ( { newRequestBuilder } ) => {
it( `${newRequestBuilder().getRouteDescription()} responds with a valid 403 response`, async () => {
const response = await newRequestBuilder()
.withJsonBodyParam( 'bot', true )
.makeRequest();

expect( response ).to.have.status( 403 );
expect( response ).to.satisfyApiSpec;
} );
} );
} );

0 comments on commit 21060cc

Please sign in to comment.