use of org.activityinfo.legacy.shared.AuthenticatedUser in project activityinfo by bedatadriven.
the class XFormResourceTest method setUp.
@Before
public void setUp() throws IOException {
objectifyService = ObjectifyService.begin();
Provider<AuthenticatedUser> authProvider = Providers.of(new AuthenticatedUser("", USER_ID, "jorden@bdd.com"));
resourceLocator = new ResourceLocatorSyncImpl(injector.getProvider(FormStorageProvider.class), authProvider, new PermissionOracle(injector.getProvider(EntityManager.class)), new BlobAuthorizerStub());
OdkFormFieldBuilderFactory fieldFactory = new OdkFormFieldBuilderFactory(resourceLocator);
AuthTokenProvider tokenService = new AuthTokenProvider();
TestBlobstoreService blobstore = new TestBlobstoreService(injector.getInstance(DeploymentConfiguration.class), injector.getInstance(EntityManager.class));
TestInstanceIdService idService = new TestInstanceIdService();
SubmissionArchiver backupService = new SubmissionArchiver(new DeploymentConfiguration(new Properties()));
formResource = new XFormResources(resourceLocator, authProvider, fieldFactory, tokenService);
formSubmissionResource = new XFormSubmissionResource(getDispatcherSync(), resourceLocator, tokenService, blobstore, idService, backupService);
}
use of org.activityinfo.legacy.shared.AuthenticatedUser in project activityinfo by bedatadriven.
the class HostControllerTest method verifyThatRequestWithValidAuthTokensReceiveTheView.
@Test
public void verifyThatRequestWithValidAuthTokensReceiveTheView() throws Exception {
authProvider.set(new AuthenticatedUser(VALID_TOKEN, 3, "akbertram@gmail.com"));
HttpServletRequest req = createMock(HttpServletRequest.class);
expect(req.getServerName()).andReturn("www.activityinfo.org");
expect(req.getHeader("User-Agent")).andReturn(CHROME_USER_AGENT);
replay(req);
Response response = resource.getHostPage(RestMockUtils.mockUriInfo("http://www.activityinfo.org"), req, false, "oldui", null, null, null);
assertThat(response.getEntity(), instanceOf(Viewable.class));
assertThat(((Viewable) response.getEntity()).getModel(), instanceOf(HostPageModel.class));
}
Aggregations