* ========================LICENSE_START=================================
* O-RAN-SC
* %%
- * Copyright (C) 2019 AT&T Intellectual Property and Nokia
+ * Copyright (C) 2019 AT&T Intellectual Property
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
import org.junit.jupiter.api.Test;
import org.onap.portalsdk.core.onboarding.util.PortalApiConstants;
import org.onap.portalsdk.core.restful.domain.EcompUser;
-import org.oransc.ric.portal.dashboard.DashboardConstants;
-import org.oransc.ric.portal.dashboard.config.WebSecurityMockConfiguration;
+import org.oransc.ric.portal.dashboard.config.PortalApIMockConfiguration;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.HttpEntity;
private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
- // paths are hardcoded here exactly like the EPSDK-FW library :(
-
@Test
public void getAnalyticsTest() {
// paths are hardcoded here exactly like the EPSDK-FW library :(
}
@Test
- public void getLoginPageTest() {
- URI uri = buildUri(null, DashboardConstants.LOGIN_PAGE);
+ public void getErrorPageTest() {
+ // Send unauthorized request
+ URI uri = buildUri(null, "/favicon.ico");
logger.info("Invoking {}", uri);
ResponseEntity<String> response = restTemplate.exchange(uri, HttpMethod.GET, null, String.class);
- Assertions.assertTrue(response.getStatusCode().is2xxSuccessful());
- Assertions.assertTrue(response.getBody().contains("Please log in"));
+ Assertions.assertTrue(response.getStatusCode().is4xxClientError());
+ Assertions.assertTrue(response.getBody().contains("Static error page"));
}
private HttpEntity<Object> getEntityWithHeaders(Object body) {
HttpHeaders headers = new HttpHeaders();
- headers.set(WebSecurityMockConfiguration.PORTAL_USERNAME_HEADER_KEY,
- WebSecurityMockConfiguration.PORTAL_USERNAME_HEADER_KEY);
- headers.set(WebSecurityMockConfiguration.PORTAL_PASSWORD_HEADER_KEY,
- WebSecurityMockConfiguration.PORTAL_PASSWORD_HEADER_KEY);
+ headers.set(PortalApIMockConfiguration.PORTAL_USERNAME_HEADER_KEY,
+ PortalApIMockConfiguration.PORTAL_USERNAME_HEADER_KEY);
+ headers.set(PortalApIMockConfiguration.PORTAL_PASSWORD_HEADER_KEY,
+ PortalApIMockConfiguration.PORTAL_PASSWORD_HEADER_KEY);
HttpEntity<Object> entity = new HttpEntity<>(body, headers);
return entity;
}