use of com.bakdata.conquery.models.forms.configs.FormConfig in project conquery by bakdata.
the class FormConfigTest method getConfig.
@Test
public void getConfig() {
// PREPARE
user.addPermission(dataset.createPermission(Ability.READ.asSet()));
ObjectMapper mapper = FormConfigProcessor.getMAPPER();
JsonNode values = mapper.valueToTree(form);
FormConfig formConfig = new FormConfig(form.getClass().getAnnotation(CPSType.class).id(), values);
formConfig.setDataset(dataset);
formConfig.setOwner(user);
user.addPermission(formConfig.createPermission(Ability.READ.asSet()));
storage.addFormConfig(formConfig);
// EXECUTE
FormConfigFullRepresentation response = processor.getConfig(user, formConfig);
// CHECK
assertThat(response).usingRecursiveComparison().ignoringFields(FormConfigOverviewRepresentation.Fields.createdAt).isEqualTo(FormConfigFullRepresentation.builder().formType(form.getClass().getAnnotation(CPSType.class).id()).id(formConfig.getId()).label(formConfig.getLabel()).own(true).ownerName(user.getLabel()).shared(false).groups(Collections.emptySet()).system(false).tags(formConfig.getTags()).values(values).build());
}
Aggregations