Commit 82187ed5 authored by Duvelis Carao's avatar Duvelis Carao
Browse files

Restoring No-access user from cosmos DB after completing integration testing

parent 235e757a
Pipeline #14447 failed with stage
in 40 seconds
......@@ -17,9 +17,12 @@ package org.opengroup.osdu.azure.entitlements.acceptanceTests;
import com.google.gson.Gson;
import com.sun.jersey.api.client.ClientResponse;
import org.apache.http.HttpStatus;
import org.junit.AfterClass;
import org.junit.Test;
import org.opengroup.osdu.azure.entitlements.model.UserInfoDoc;
import org.opengroup.osdu.azure.entitlements.model.UserTenantItem;
import org.opengroup.osdu.azure.entitlements.utils.FileHandler;
import org.opengroup.osdu.azure.entitlements.utils.TestUserInfoData;
import org.opengroup.osdu.azure.entitlements.utils.TestUtils;
......@@ -61,6 +64,25 @@ public class EntitlementsApiTests {
OTHER
}
@AfterClass
public static void tearDown() {
//Restore the Non-access user in cosmos DB
try {
String json = FileHandler.readFile(String.format("%s.json", "test_restore_no_access_sp"));
UserInfoDoc userInfoDoc = TestUserInfoData.fromJson(json);
userInfoDoc.setUid(TEST_SP_ID);
userInfoDoc.setId(TEST_SP_OID);
UserTenantItem[] tenant = userInfoDoc.getTenants();
tenant[0].setName(TestUtils.getTenantName());
json = TestUserInfoData.toJson(userInfoDoc);
String path = "profile";
ClientResponse response = TestUtils.send(path, "POST", TestUtils.getHeaders(), json, "");
assertEquals(HttpStatus.SC_CREATED, response.getStatus());
} catch (Exception ex) {
throw new AssertionError(ex.getMessage());
}
}
@Test
public void givenAnonymous_whenCallGetGroups_thenForbidden() throws Exception {
String path = "groups";
......
{
"id": "",
"uid": "",
"tenants": [
{
"name": "",
"groups": [
"service.storage.admin",
"service.legal.admin"
]
}
]
}
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment