Skip to content

Commit

Permalink
add mock authentication
Browse files Browse the repository at this point in the history
  • Loading branch information
neojunjie committed Jul 7, 2022
1 parent 04f739d commit 412c22e
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
package entities;

import com.datahub.authentication.Actor;
import com.datahub.authentication.ActorType;
import com.datahub.authentication.Authentication;
import com.datahub.authentication.AuthenticationContext;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.linkedin.metadata.entity.AspectDao;
import com.linkedin.metadata.event.EventProducer;
Expand Down Expand Up @@ -34,6 +38,7 @@
import org.testng.annotations.Test;

import static com.linkedin.metadata.Constants.*;
import static org.mockito.Mockito.when;


public class EntitiesControllerTest {
Expand All @@ -53,6 +58,9 @@ public void setup()
EventProducer mockEntityEventProducer = Mockito.mock(EventProducer.class);
MockEntityService mockEntityService = new MockEntityService(aspectDao, mockEntityEventProducer, mockEntityRegistry);
_entitiesController = new EntitiesController(mockEntityService, new ObjectMapper());
Authentication authentication = Mockito.mock(Authentication.class);
when(authentication.getActor()).thenReturn(new Actor(ActorType.USER, "datahub"));
AuthenticationContext.setAuthentication(authentication);
}

EntitiesController _entitiesController;
Expand Down

0 comments on commit 412c22e

Please sign in to comment.