Skip to content

Commit

Permalink
tests
Browse files Browse the repository at this point in the history
  • Loading branch information
manan164 committed Sep 12, 2023
1 parent 06ca3c8 commit f502a11
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import io.orkes.conductor.client.util.ApiUtil;
import io.orkes.conductor.client.util.Commons;

import static io.orkes.conductor.client.util.Commons.getTagObject;
import static org.junit.jupiter.api.Assertions.*;

public class AuthorizationClientTests extends ClientTest {
Expand Down Expand Up @@ -143,6 +144,10 @@ void testApplication() {
assertEquals(1, accessKeyResponses.size());
authorizationClient.toggleAccessKeyStatus(application.getId(), accessKey.getId());
authorizationClient.deleteAccessKey(application.getId(), accessKey.getId());
authorizationClient.setApplicationTags(getTagObject(), application.getId());
assertEquals(getTagObject(), authorizationClient.getApplicationTags(application.getId()));
authorizationClient.deleteApplicationTags(getTagObject(), application.getId());
assertEquals(0, authorizationClient.getApplicationTags(application.getId()).size());
accessKeyResponses = authorizationClient.getAccessKeys(application.getId());
assertEquals(0, accessKeyResponses.size());

Expand Down Expand Up @@ -317,4 +322,12 @@ AuthorizationRequest getAuthorizationRequest() {
request.setTarget(target);
return request;
}

private List<TagObject> getTagObject() {
TagObject tagObject = new TagObject();
tagObject.setType(TagObject.TypeEnum.METADATA);
tagObject.setKey("department");
tagObject.setValue("accounts");
return List.of(tagObject);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,16 @@
*/
package io.orkes.conductor.client.api;

import io.orkes.conductor.client.model.TagObject;
import org.junit.jupiter.api.Test;

import io.orkes.conductor.client.SchedulerClient;
import io.orkes.conductor.client.model.SaveScheduleRequest;
import io.orkes.conductor.client.model.WorkflowSchedule;
import io.orkes.conductor.client.util.Commons;

import java.util.List;

import static org.junit.jupiter.api.Assertions.*;

public class SchedulerClientTests extends ClientTest {
Expand All @@ -41,6 +44,10 @@ void testMethods() {
assertEquals(NAME, workflowSchedule.getName());
assertEquals(CRON_EXPRESSION, workflowSchedule.getCronExpression());
assertFalse(schedulerClient.searchV22(0, 10, "ASC", "*", "").getResults().isEmpty());
schedulerClient.setSchedulerTags(getTagObject(), NAME);
assertEquals(getTagObject(), schedulerClient.getSchedulerTags(NAME));
schedulerClient.deleteSchedulerTags(getTagObject(), NAME);
assertEquals(0, schedulerClient.getSchedulerTags(NAME).size());
schedulerClient.pauseSchedule(NAME);
workflowSchedule = schedulerClient.getSchedule(NAME);
assertTrue(workflowSchedule.isPaused());
Expand All @@ -63,4 +70,12 @@ SaveScheduleRequest getSaveScheduleRequest() {
.cronExpression(CRON_EXPRESSION)
.startWorkflowRequest(Commons.getStartWorkflowRequest());
}

private List<TagObject> getTagObject() {
TagObject tagObject = new TagObject();
tagObject.setType(TagObject.TypeEnum.METADATA);
tagObject.setKey("department");
tagObject.setValue("accounts");
return List.of(tagObject);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ void testMethods() {
}
secretClient.putSecret(SECRET_NAME, SECRET_KEY);
secretClient.setSecretTags(List.of(getTagObject()), SECRET_KEY);
List<TagObject> tags = secretClient.getSecretTags(SECRET_KEY);
assertEquals(tags.size(), 1);
assertEquals(tags.get(0), getTagObject());
secretClient.deleteSecretTags(List.of(getTagObject()), SECRET_KEY);
assertEquals(secretClient.getSecretTags(SECRET_KEY).size(), 0);
assertTrue(secretClient.listSecretsThatUserCanGrantAccessTo().contains(SECRET_KEY));
assertTrue(secretClient.listAllSecretNames().contains(SECRET_KEY));
assertEquals(SECRET_NAME, secretClient.getSecret(SECRET_KEY));
Expand Down

0 comments on commit f502a11

Please sign in to comment.