blob: be7d651a87a1353bb6fb7ad5b146ae2e86027d88 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
package org.onap.dcae.ci.api.tests.services.list;
import static org.assertj.core.api.Assertions.assertThat;
import static org.testng.Assert.fail;
import java.io.IOException;
import org.onap.dcae.ci.api.tests.DcaeRestBaseTest;
import org.onap.dcae.ci.entities.RestResponse;
import org.onap.dcae.ci.utilities.DcaeRestClient;
import org.onap.dcae.ci.report.Report;
import org.onap.dcae.ci.utilities.StringUtils;
import org.testng.annotations.Test;
import org.onap.sdc.dcae.composition.vfcmt.Vfcmt;
import com.aventstack.extentreports.Status;
public class GetAllServicesNagative extends DcaeRestBaseTest {
@Test
public void userNotLastUpdater_statusCode403() throws Exception{
// arrange
String user1 = DcaeRestClient.getDefaultUserId();
String user2 = DcaeRestClient.getDesigner2UserId();
Vfcmt vfcmt = null;
try {
vfcmt = client.createCheckedoutVfcmt(user1);
} catch (Exception err) {
fail("Unable to arrange test", err);
}
// act
Report.log(Status.INFO, "GetServices for user that is not the vfcmt last-updater");
RestResponse response = getServices(vfcmt.getUuid(), user2);
// assert
assertThat(response.getStatusCode()).as("response status").isEqualTo(403);
}
/* Private Methods */
private RestResponse getServices(String uuid, String user2) throws IOException {
RestResponse response = DcaeRestClient.getServices(uuid, user2);
Report.log(Status.DEBUG, "Response: " + StringUtils.truncate(response));
return response;
}
}
|