Acceptance tests: Add a helper method to renew the request context
Renewing the request context is e.g. needed for email tests, because the IdentifiedUser caches the email addresses and needs to be recreated if new emails were added. Change-Id: Ib5699baab32febe62e904b65ee02c25f23c17a7c Signed-off-by: Edwin Kempin <ekempin@google.com>
This commit is contained in:
@@ -696,6 +696,16 @@ public abstract class AbstractDaemonTest {
|
||||
identifiedUserFactory.create(account.getId()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Enforce a new request context for the current API user.
|
||||
*
|
||||
* <p>This recreates the IdentifiedUser, hence everything which is cached in the IdentifiedUser is
|
||||
* reloaded (e.g. the email addresses of the user).
|
||||
*/
|
||||
protected Context resetCurrentApiUser() {
|
||||
return atrScope.set(newRequestContext(atrScope.get().getSession().getAccount()));
|
||||
}
|
||||
|
||||
protected Context setApiUser(TestAccount account) {
|
||||
return atrScope.set(newRequestContext(account));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user