use of io.gravitee.am.model.Form in project gravitee-access-management by gravitee-io.
the class FormResourceTest method shouldUpdate.
@Test
@Ignore
public void shouldUpdate() {
final String formId = "form-1";
final String domainId = "domain-1";
final Domain mockDomain = new Domain();
mockDomain.setId(domainId);
UpdateForm updateForm = new UpdateForm();
updateForm.setContent("content");
doReturn(Maybe.just(mockDomain)).when(domainService).findById(domainId);
doReturn(Single.just(new Form())).when(formService).update(eq(domainId), eq(formId), any(), any(User.class));
final Response response = target("domains").path(domainId).path("forms").path(formId).request().put(Entity.json(updateForm));
assertEquals(HttpStatusCode.OK_200, response.getStatus());
}
use of io.gravitee.am.model.Form in project gravitee-access-management by gravitee-io.
the class FormsResourceTest method shouldGetForm.
@Test
public void shouldGetForm() throws IOException {
final String domainId = "domain-1";
final Domain mockDomain = new Domain();
mockDomain.setId(domainId);
final Form mockForm = new Form();
mockForm.setId("form-1-id");
mockForm.setTemplate(Template.LOGIN.template());
mockForm.setReferenceType(ReferenceType.DOMAIN);
mockForm.setReferenceId(domainId);
doReturn(Maybe.just(mockForm)).when(formService).findByDomainAndTemplate(domainId, Template.LOGIN.template());
final Response response = target("domains").path(domainId).path("forms").queryParam("template", Template.LOGIN).request().get();
assertEquals(HttpStatusCode.OK_200, response.getStatus());
final Form responseEntity = readEntity(response, Form.class);
assertTrue(responseEntity.getId().equals("form-1-id"));
}
Aggregations