lasdf1234 commented on code in PR #10971:
URL: https://github.com/apache/gravitino/pull/10971#discussion_r3213148821


##########
server/src/test/java/org/apache/gravitino/server/TestGravitinoServer.java:
##########
@@ -136,4 +176,174 @@ public void testMainShutdownHookShouldInvokeServerStop() 
throws IOException {
         hookBlock.contains("server.gracefulStop()"),
         "Shutdown hook should invoke server.gracefulStop() so app-level 
cleanup runs on SIGTERM");
   }
+
+  @Test
+  public void testInitializeRestApiExposesIdpInterfaces() throws Exception {
+    ServerConfig serverConfig = new ServerConfig();
+    serverConfig.loadFromMap(
+        ImmutableMap.of(
+            Configs.AUTHENTICATORS.getKey(), "oauth",
+            Configs.ENABLE_AUTHORIZATION.getKey(), "true",
+            Configs.SERVICE_ADMINS.getKey(), "admin",
+            Configs.REST_API_EXTENSION_PACKAGES.getKey(), 
"org.apache.gravitino.test.extension"),
+        t -> true);
+
+    IdpManager idpManager = Mockito.mock(IdpManager.class);
+    Mockito.when(idpManager.getUser("user1"))
+        .thenReturn(
+            
IdpUserDTO.builder().withName("user1").withGroups(Collections.emptyList()).build());
+
+    try (IdpUserServerTestContext adminContext =
+        newIdpUserServerTestContext(serverConfig, idpManager, "admin")) {
+      Response response =
+          adminContext
+              .jerseyTest()
+              .target("/idp/users/user1")
+              .request("application/vnd.gravitino.v1+json")
+              .get();
+      assertEquals(Response.Status.OK.getStatusCode(), response.getStatus());
+
+      IdpUserResponse userResponse = 
response.readEntity(IdpUserResponse.class);
+      assertEquals("user1", userResponse.getUser().name());
+    }
+
+    try (IdpUserServerTestContext selfContext =
+        newIdpUserServerTestContext(serverConfig, idpManager, "user1")) {
+      Response response =
+          selfContext
+              .jerseyTest()
+              .target("/idp/users/user1")
+              .request("application/vnd.gravitino.v1+json")
+              .get();
+      assertEquals(Response.Status.OK.getStatusCode(), response.getStatus());
+    }

Review Comment:
   Since the owner of the user requires the functionality related to basic 
authentication, the next PR will include this part of the test.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to