Search in sources :

Example 11 with JsonMetadataProposal

use of org.hisp.dhis.webapi.controller.json.JsonMetadataProposal in project dhis2-core by dhis2.

the class MetadataWorkflowControllerTest method testAcceptRemoveProposal.

@Test
void testAcceptRemoveProposal() {
    String proposalId = postRemoveProposal(defaultTargetId);
    assertStatus(HttpStatus.OK, POST("/metadata/proposals/" + proposalId));
    assertStatus(HttpStatus.NOT_FOUND, GET("/organisationUnits/{uid}", defaultTargetId));
    JsonMetadataProposal proposal = GET("/metadata/proposals/{uid}", proposalId).content().asObject(JsonMetadataProposal.class);
    assertEquals(MetadataProposalStatus.ACCEPTED, proposal.getStatus());
    assertNotNull(proposal.getFinalisedBy());
    assertNotNull(proposal.getFinalised());
}
Also used : JsonMetadataProposal(org.hisp.dhis.webapi.controller.json.JsonMetadataProposal) DhisControllerConvenienceTest(org.hisp.dhis.webapi.DhisControllerConvenienceTest) Test(org.junit.jupiter.api.Test)

Example 12 with JsonMetadataProposal

use of org.hisp.dhis.webapi.controller.json.JsonMetadataProposal in project dhis2-core by dhis2.

the class MetadataWorkflowControllerTest method testMakeUpdateProposal.

@Test
void testMakeUpdateProposal() {
    String proposalId = postUpdateNameProposal(defaultTargetId, "New Name");
    JsonMetadataProposal proposal = GET("/metadata/proposals/{uid}", proposalId).content().asObject(JsonMetadataProposal.class);
    assertEquals(MetadataProposalStatus.PROPOSED, proposal.getStatus());
    assertEquals(MetadataProposalType.UPDATE, proposal.getType());
    assertEquals(MetadataProposalTarget.ORGANISATION_UNIT, proposal.getTarget());
    assertEquals(defaultTargetId, proposal.getTargetId());
    assertNotNull(proposal.getCreated());
    assertNotNull(proposal.getCreatedBy());
    assertNull(proposal.getFinalisedBy());
    assertNull(proposal.getFinalised());
    assertNull(proposal.getComment());
    assertNull(proposal.getReason());
    assertTrue(proposal.getChange().isArray());
}
Also used : JsonMetadataProposal(org.hisp.dhis.webapi.controller.json.JsonMetadataProposal) DhisControllerConvenienceTest(org.hisp.dhis.webapi.DhisControllerConvenienceTest) Test(org.junit.jupiter.api.Test)

Aggregations

DhisControllerConvenienceTest (org.hisp.dhis.webapi.DhisControllerConvenienceTest)12 JsonMetadataProposal (org.hisp.dhis.webapi.controller.json.JsonMetadataProposal)12 Test (org.junit.jupiter.api.Test)12 JsonOrganisationUnit (org.hisp.dhis.webapi.json.domain.JsonOrganisationUnit)2 User (org.hisp.dhis.user.User)1 JsonErrorReport (org.hisp.dhis.webapi.json.domain.JsonErrorReport)1 JsonWebMessage (org.hisp.dhis.webapi.json.domain.JsonWebMessage)1