use of org.hisp.dhis.webapi.json.domain.JsonDataIntegrityDetails in project dhis2-core by dhis2.
the class DataIntegrityCategoriesControllerTest method testDetailsCategories_one_default_category_option.
/**
* Ideally we would have created a second category option named default, but
* we have made this impossible by unique constraint. So the best we can do
* is changing the UID of the existing default to some other UID.
*/
@Test
void testDetailsCategories_one_default_category_option() {
String uid = CodeGenerator.generateUid();
assertEquals(uid, updateDefaultCategoryOptionToUid(uid));
postDetails("categories_one_default_category_option");
JsonDataIntegrityDetails details = getDetails("categories_one_default_category_option");
assertEquals(1, details.getIssues().size());
assertEquals(uid, details.getIssues().get(0).getId());
assertEquals("default", details.getIssues().get(0).getName());
}
use of org.hisp.dhis.webapi.json.domain.JsonDataIntegrityDetails in project dhis2-core by dhis2.
the class DataIntegrityCategoriesControllerTest method testDetailsCategories_no_options.
@Test
void testDetailsCategories_no_options() {
String uid = assertStatus(HttpStatus.CREATED, POST("/categories", "{'name': 'CatDog', 'shortName': 'CD', 'dataDimensionType': 'ATTRIBUTE'}"));
postDetails("categories-no-options");
JsonDataIntegrityDetails details = getDetails("categories-no-options");
assertEquals(1, details.getIssues().size());
assertEquals(uid, details.getIssues().get(0).getId());
assertEquals("CatDog", details.getIssues().get(0).getName());
}
use of org.hisp.dhis.webapi.json.domain.JsonDataIntegrityDetails in project dhis2-core by dhis2.
the class DataIntegrityCategoriesControllerTest method testDetailsCategories_one_default_category.
/**
* Ideally we would have created a second category named default, but we
* have made this impossible by unique constraint. So the best we can do is
* changing the UID of the existing default to some other UID.
*/
@Test
void testDetailsCategories_one_default_category() {
String uid = CodeGenerator.generateUid();
assertEquals(uid, updateDefaultCategoryToUid(uid));
postDetails("categories_one_default_category");
JsonDataIntegrityDetails details = getDetails("categories_one_default_category");
assertEquals(1, details.getIssues().size());
assertEquals(uid, details.getIssues().get(0).getId());
assertEquals("default", details.getIssues().get(0).getName());
}
use of org.hisp.dhis.webapi.json.domain.JsonDataIntegrityDetails in project dhis2-core by dhis2.
the class DataIntegrityCategoriesControllerTest method testDetailsCategories_one_default_category_combo.
/**
* Ideally we would have created a second category combo named default, but
* we have made this impossible by unique constraint. So the best we can do
* is changing the UID of the existing default to some other UID.
*/
@Test
void testDetailsCategories_one_default_category_combo() {
String uid = CodeGenerator.generateUid();
assertEquals(uid, updateDefaultCategoryComboToUid(uid));
postDetails("categories_one_default_category_combo");
JsonDataIntegrityDetails details = getDetails("categories_one_default_category_combo");
assertEquals(1, details.getIssues().size());
assertEquals(uid, details.getIssues().get(0).getId());
assertEquals("default", details.getIssues().get(0).getName());
}
use of org.hisp.dhis.webapi.json.domain.JsonDataIntegrityDetails in project dhis2-core by dhis2.
the class DataIntegrityDetailsControllerTest method testLegacyChecksOnly.
@Test
void testLegacyChecksOnly() {
for (DataIntegrityCheckType type : DataIntegrityCheckType.values()) {
String check = type.getName();
postDetails(check);
JsonDataIntegrityDetails details = getDetails(check);
assertTrue(details.getIssues().isEmpty());
}
}
Aggregations