@GetMapping(
        path = "/admin/publisher/{provider}/{loginName}",
        produces = MediaType.APPLICATION_JSON_VALUE
    )
    public ResponseEntity<UserPublishInfoJson> getUserPublishInfo(@PathVariable String provider, @PathVariable String loginName) {
        try {
            admins.checkAdminUser();
            var userPublishInfo = admins.getUserPublishInfo(provider, loginName);
            return ResponseEntity.ok(userPublishInfo);
        } catch (ErrorResultException exc) {
            return exc.toResponseEntity(UserPublishInfoJson.class);
        }
    }
@Test
    public void testGetUserPublishInfo() throws Exception {
        mockAdminUser();
        var versions = mockExtension(1, 0, 0);
        var user = new UserData();
        user.setLoginName("test");
        user.setProvider("github");

        var token = new PersonalAccessToken();
        token.setUser(user);
        token.setActive(true);
        versions.forEach(v -> v.setPublishedWith(token));

        Mockito.when(repositories.findUserByLoginName("github", "test")).thenReturn(user);
        Mockito.when(repositories.countActiveAccessTokens(user)).thenReturn(1L);
        Mockito.when(repositories.findLatestVersions(user)).thenReturn(versions);

        mockMvc.perform(get("/admin/publisher/{provider}/{loginName}", "github", "test")
                .with(user("admin_user").authorities(new SimpleGrantedAuthority(("ROLE_ADMIN"))))
                .with(csrf().asHeader()))
                .andExpect(status().isOk())
                .andExpect(content().json(publishInfoJson(upi -> {
                    upi.user = new UserJson();
                    upi.user.loginName = "test";
                    upi.activeAccessTokenNum = 1;
                    var ext1 = new ExtensionJson();
                    ext1.namespace = "foobar";
                    ext1.name = "baz";
                    ext1.version = "1.0.0";
                    upi.extensions = Arrays.asList(ext1);
                })));
    }