-
Type: Improvement
-
Status: Resolved
-
Priority: Major
-
Resolution: Fixed
-
Affects Version/s: None
-
Fix Version/s: None
-
Component/s: None
To change the session user identity in a test method use the following code:
featuresRunner.getFeature(CoreFeature.class).getRepository().switchUser(username);
where featuresRunner can be injected in a test field like this:
@Inject
protected FeaturesRunner featuresRunner;
Note that this is a fake login. In tests no real login is done - but the session context map is used to
inject the current login. (May be we want to change this behavior and use real login)
There are various flavors of this method:
switchUser(String username, boolean isAdministrator, boolean isAnonymous);
switchSystemUser()
switchAdminUser(String username)
- is required by
-
NXP-8015 Fix TestRepositoryHandler#changeUser test method
- Resolved