Skip to content
This repository has been archived by the owner on Nov 11, 2024. It is now read-only.

Commit

Permalink
Added mock env
Browse files Browse the repository at this point in the history
Signed-off-by: Aashir Siddiqui <[email protected]>
  • Loading branch information
aashir21 committed Aug 13, 2024
1 parent 1badf4a commit 970202c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,16 @@
*/
package dev.galasa.framework.api.users.mocks;

import dev.galasa.framework.api.common.Environment;
import dev.galasa.framework.api.users.UsersServlet;
import dev.galasa.framework.spi.IFramework;

public class MockUsersServlet extends UsersServlet{

public void setEnvironment(Environment env) {
this.env = env;
}

@Override
public void setFramework(IFramework framework) {
super.setFramework(framework);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,12 @@
import org.junit.Test;

import dev.galasa.framework.api.common.BaseServletTest;
import dev.galasa.framework.api.common.EnvironmentVariables;
import dev.galasa.framework.api.common.mocks.MockEnvironment;
import dev.galasa.framework.api.common.mocks.MockHttpServletRequest;
import dev.galasa.framework.api.common.mocks.MockHttpServletResponse;
import dev.galasa.framework.api.users.UsersServlet;
import dev.galasa.framework.api.users.mocks.MockUsersServlet;

public class UsersRouteTest extends BaseServletTest {

Expand Down Expand Up @@ -53,7 +56,10 @@ public void testUsersGetRequestWithMissingNameParamReturnsBadRequest() throws Ex
@Test
public void testUsersGetRequestReturnsArrayOfUsersReturns_OK() throws Exception {
// Given...
UsersServlet servlet = new UsersServlet();
MockUsersServlet servlet = new MockUsersServlet();
MockEnvironment env = new MockEnvironment();
env.setenv(EnvironmentVariables.GALASA_USERNAME_CLAIMS, "preferred_username");
servlet.setEnvironment(env);

String requestorLoginId = "me";

Expand Down

0 comments on commit 970202c

Please sign in to comment.