Remove check of messages in REST response in Unit Tests !!!
MODIFY
test/api/AuthenticationTest.ts
test/api/AuthenticationTest.ts
@@ -327,13 +327,11 @@ describe('Authentication Service (utall)', function() {
it('should not be possible to verify email for the Super Tenant', async () => {
const response = await CentralServerService.defaultInstance.authenticationApi.verifyEmail('unknown@sap.com', 'unknownVerificationToken', '');
expect(response.status).to.be.eql(StatusCodes.INTERNAL_SERVER_ERROR);
- expect(response.data.message).to.be.eq('Cannot verify email in the Super Tenant');
});
it('should not be possible to request verification email for the Super Tenant', async () => {
const response = await CentralServerService.defaultInstance.authenticationApi.resendVerificationEmail('unknown@sap.com', '');
expect(response.status).to.be.eql(StatusCodes.INTERNAL_SERVER_ERROR);
- expect(response.data.message).to.be.eq('Cannot request a verification Email in the Super Tenant');
});
});
});

MODIFY
test/api/CarTest.ts
test/api/CarTest.ts
@@ -133,7 +133,6 @@ describe('Car', function() {
}), false
);
expect(response.status).to.equal(StatusCodes.INTERNAL_SERVER_ERROR);
- expect(response.data.message).to.equal('Vin Car is mandatory');
});
it('Should not be able to create a new car without a license plate', async () => {
@@ -145,7 +144,6 @@ describe('Car', function() {
}), false
);
expect(response.status).to.equal(StatusCodes.INTERNAL_SERVER_ERROR);
- expect(response.data.message).to.equal('License Plate is mandatory');
});
it('Should not be able to create a new car without a car type', async () => {
@@ -168,7 +166,6 @@ describe('Car', function() {
}), false
);
expect(response.status).to.equal(StatusCodes.INTERNAL_SERVER_ERROR);
- expect(response.data.message).to.equal('Car Catalog ID is mandatory');
});
it('Should not be able to create a new car with existent VIN and License Plate', async () => {

MODIFY
test/api/SmartChargingTest.ts
test/api/SmartChargingTest.ts
@@ -326,7 +326,6 @@ describe('Smart Charging Service', function() {
sapSmartChargingSettings.optimizerUrl = '';
await TestData.saveSmartChargingSettings(testData, sapSmartChargingSettings);
const response = await testData.userService.smartChargingApi.testConnection({});
- expect(response.data.message).include('SAP Smart Charging service configuration is incorrect');
});
describe('Test for three phased site area', () => {

MODIFY
test/api/StatisticsTest.ts
test/api/StatisticsTest.ts
@@ -91,73 +91,58 @@ describe('Statistics', function() {
it('Is not authorized to access consumption data', async () => {
let adminUserListResponse = await adminUserServerServiceNothing.statisticsApi.readChargingStationConsumption({ Year: firstYear });
expect(adminUserListResponse.status).to.be.eql(StatusCodes.FORBIDDEN);
- expect(adminUserListResponse.data.message).to.contain('not authorized');
adminUserListResponse = await adminUserServerServiceNothing.statisticsApi.readUserConsumption({ Year: firstYear });
expect(adminUserListResponse.status).to.be.eql(StatusCodes.FORBIDDEN);
- expect(adminUserListResponse.data.message).to.contain('not authorized');
});
it('Is not authorized to access usage data', async () => {
let adminUserListResponse = await adminUserServerServiceNothing.statisticsApi.readChargingStationUsage({ Year: firstYear });
expect(adminUserListResponse.status).to.be.eql(StatusCodes.FORBIDDEN);
- expect(adminUserListResponse.data.message).to.contain('not authorized');
adminUserListResponse = await adminUserServerServiceNothing.statisticsApi.readUserUsage({ Year: firstYear });
expect(adminUserListResponse.status).to.be.eql(StatusCodes.FORBIDDEN);
- expect(adminUserListResponse.data.message).to.contain('not authorized');
});
it('Is not authorized to access inactivity data', async () => {
let adminUserListResponse = await adminUserServerServiceNothing.statisticsApi.readChargingStationInactivity({ Year: firstYear });
expect(adminUserListResponse.status).to.be.eql(StatusCodes.FORBIDDEN);
- expect(adminUserListResponse.data.message).to.contain('not authorized');
adminUserListResponse = await adminUserServerServiceNothing.statisticsApi.readUserInactivity({ Year: firstYear });
expect(adminUserListResponse.status).to.be.eql(StatusCodes.FORBIDDEN);
- expect(adminUserListResponse.data.message).to.contain('not authorized');
});
it('Is not authorized to access sessions data', async () => {
let adminUserListResponse = await adminUserServerServiceNothing.statisticsApi.readChargingStationTransactions({ Year: firstYear });
expect(adminUserListResponse.status).to.be.eql(StatusCodes.FORBIDDEN);
- expect(adminUserListResponse.data.message).to.contain('not authorized');
adminUserListResponse = await adminUserServerServiceNothing.statisticsApi.readUserTransactions({ Year: firstYear });
expect(adminUserListResponse.status).to.be.eql(StatusCodes.FORBIDDEN);
- expect(adminUserListResponse.data.message).to.contain('not authorized');
});
it('Is not authorized to access pricing data', async () => {
let adminUserListResponse = await adminUserServerServiceNothing.statisticsApi.readChargingStationPricing({ Year: firstYear });
expect(adminUserListResponse.status).to.be.eql(StatusCodes.FORBIDDEN);
- expect(adminUserListResponse.data.message).to.contain('not authorized');
adminUserListResponse = await adminUserServerServiceNothing.statisticsApi.readUserPricing({ Year: firstYear });
expect(adminUserListResponse.status).to.be.eql(StatusCodes.FORBIDDEN);
- expect(adminUserListResponse.data.message).to.contain('not authorized');
});
it('Is not authorized to export data to file', async () => {
let adminUserListResponse = await adminUserServerServiceNothing.statisticsApi.exportStatistics({ Year: firstYear, DataType: 'Consumption', DataCategory: 'C', DataScope: 'month' });
expect(adminUserListResponse.status).to.be.eql(StatusCodes.FORBIDDEN);
- expect(adminUserListResponse.data.message).to.contain('not authorized');
adminUserListResponse = await adminUserServerServiceNothing.statisticsApi.exportStatistics({ Year: firstYear, DataType: 'Usage', DataCategory: 'U', DataScope: 'month' });
expect(adminUserListResponse.status).to.be.eql(StatusCodes.FORBIDDEN);
- expect(adminUserListResponse.data.message).to.contain('not authorized');
adminUserListResponse = await adminUserServerServiceNothing.statisticsApi.exportStatistics({ Year: firstYear, DataType: 'Inactivity', DataCategory: 'U', DataScope: 'total' });
expect(adminUserListResponse.status).to.be.eql(StatusCodes.FORBIDDEN);
- expect(adminUserListResponse.data.message).to.contain('not authorized');
adminUserListResponse = await adminUserServerServiceNothing.statisticsApi.exportStatistics({ Year: firstYear, DataType: 'Transactions', DataCategory: 'C', DataScope: 'total' });
expect(adminUserListResponse.status).to.be.eql(StatusCodes.FORBIDDEN);
- expect(adminUserListResponse.data.message).to.contain('not authorized');
adminUserListResponse = await adminUserServerServiceNothing.statisticsApi.exportStatistics({ Year: firstYear, DataType: 'Pricing', DataCategory: 'U', DataScope: 'month' });
expect(adminUserListResponse.status).to.be.eql(StatusCodes.FORBIDDEN);
- expect(adminUserListResponse.data.message).to.contain('not authorized');
});
});

MODIFY
test/api/TransactionCommonTests.ts
test/api/TransactionCommonTests.ts
@@ -107,7 +107,6 @@ export default class TransactionCommonTests {
} else {
expect(transactionResponse.status).eq(StatusCodes.FORBIDDEN);
expect(transactionResponse.data).not.null;
- expect(transactionResponse.data.message).eq(`Role Basic is not authorized to perform Read on Transaction '${response.transactionId}'`);
}
}

Remove check of messages in REST response in Unit Tests !!!