Added a plugin test.
Change-Id: I3153dd978c05cd27050c34ef9eb985049f697cbe
diff --git a/full/Changes b/full/Changes
index 04f388e..c3f651b 100644
--- a/full/Changes
+++ b/full/Changes
@@ -14,7 +14,11 @@
2023-02-06
- Allow admin access using admin token for the clean token API
2023-02-10
+<<<<<<< Upstream, based on master
- Use admin filter instead of OAuth2 ADMIN scope
+=======
+- Added a plugin test.
+>>>>>>> 6bd726f Added a plugin test.
# version 0.69.1
diff --git a/full/src/test/java/de/ids_mannheim/korap/web/controller/OAuth2PluginTest.java b/full/src/test/java/de/ids_mannheim/korap/web/controller/OAuth2PluginTest.java
index 9d9a398..4a469bc 100644
--- a/full/src/test/java/de/ids_mannheim/korap/web/controller/OAuth2PluginTest.java
+++ b/full/src/test/java/de/ids_mannheim/korap/web/controller/OAuth2PluginTest.java
@@ -7,8 +7,11 @@
import java.io.IOException;
+import javax.ws.rs.ProcessingException;
+import javax.ws.rs.client.Entity;
import javax.ws.rs.core.Form;
-import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.Response.Status;
import org.apache.http.entity.ContentType;
import org.junit.Test;
@@ -16,10 +19,6 @@
import com.fasterxml.jackson.databind.JsonNode;
import com.google.common.net.HttpHeaders;
-import javax.ws.rs.ProcessingException;
-import javax.ws.rs.core.Response;
-import javax.ws.rs.core.Response.Status;
-import javax.ws.rs.client.Entity;
import de.ids_mannheim.korap.authentication.http.HttpAuthorizationHandler;
import de.ids_mannheim.korap.config.Attributes;
@@ -488,9 +487,25 @@
node = retrieveUserInstalledPlugin(getSuperClientForm());
assertEquals(0, node.size());
+ testReinstallUninstalledPlugin();
+
testUninstallNotInstalledPlugin();
}
+ private void testReinstallUninstalledPlugin ()
+ throws ProcessingException, KustvaktException {
+ testInstallConfidentialPlugin(superClientId, confidentialClientId2,
+ username);
+ JsonNode node = retrieveUserInstalledPlugin(getSuperClientForm());
+ assertEquals(1, node.size());
+
+ Response response = uninstallPlugin(confidentialClientId2, username);
+ assertEquals(Status.OK.getStatusCode(), response.getStatus());
+
+ node = retrieveUserInstalledPlugin(getSuperClientForm());
+ assertEquals(0, node.size());
+ }
+
private JsonNode testRequestAccessToken (String clientId) throws KustvaktException {
String userAuthHeader = HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue(username, "password");