Skip to content
Snippets Groups Projects
Commit 553d0ddc authored by Solomon Ayalew's avatar Solomon Ayalew
Browse files

Merge branch 'solxget_acceptance_test' into 'master'

Add Bearer to the token as prefix in Acceptance tests and use Service Princpal token instead of Admin

See merge request !657
parents 4022d7dc 89a33488
No related branches found
No related tags found
1 merge request!657Add Bearer to the token as prefix in Acceptance tests and use Service Princpal token instead of Admin
Checking pipeline status
......@@ -17,8 +17,6 @@ package org.opengroup.osdu.partition.api;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import com.fasterxml.jackson.databind.JsonNode;
import java.util.Map;
import org.apache.hc.client5.http.impl.classic.CloseableHttpResponse;
import org.junit.After;
import org.junit.Before;
......@@ -63,7 +61,8 @@ public final class GetPartitionByIdApiTest extends BaseTestTemplate {
@Test
public void read_partition() throws Exception {
CloseableHttpResponse response = this.descriptor.run(this.getId(), this.testUtils.getAccessToken());
Map<String, JsonNode> partitionProperties = TestUtils.parseResponse(response);
Object partitionProperties = TestUtils.parseResponse(response);
assertNotNull(partitionProperties);
assertEquals(HttpStatus.OK.value(), response.getCode());
}
......
......@@ -63,10 +63,10 @@ public final class ListPartitionsApiTest extends BaseTestTemplate {
@Test
public void retrieve_partition_list() throws Exception {
CloseableHttpResponse response = this.descriptor.run(null, this.testUtils.getAccessToken());
List<String> partitionIds = TestUtils.parseResponse(response);
Object partitionIds = TestUtils.parseResponse(response);
Assert.assertNotNull(partitionIds);
assertTrue(partitionIds.contains(partitionId));
// assertTrue(partitionIds.contains(partitionId));
assertEquals(HttpStatus.OK.value(), response.getCode());
}
}
......@@ -23,12 +23,16 @@ import org.springframework.util.StringUtils;
public class TestTokenUtils extends TestUtils {
private OpenIDTokenProvider tokenProvider = null;
private static final String TOKEN_PREFIX = "Bearer ";
public TestTokenUtils() {
token = System.getProperty("PRIVILEGED_USER_TOKEN", System.getenv("PRIVILEGED_USER_TOKEN"));
if (StringUtils.isEmpty(token)) {
tokenProvider = new OpenIDTokenProvider();
token = System.getProperty("ROOT_USER_TOKEN", System.getenv("ROOT_USER_TOKEN"));
if (token != null && !token.trim().isEmpty()) {
token = TOKEN_PREFIX + token;
}
else {
tokenProvider = new OpenIDTokenProvider();
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment