test(系统设置): 添加组织管理用例
This commit is contained in:
parent
585701c174
commit
50302a0145
|
@ -48,9 +48,6 @@ public class OrganizationServiceImpl implements OrganizationService{
|
||||||
OrganizationExample example = new OrganizationExample();
|
OrganizationExample example = new OrganizationExample();
|
||||||
example.createCriteria().andNumEqualTo(100001L);
|
example.createCriteria().andNumEqualTo(100001L);
|
||||||
List<Organization> organizations = organizationMapper.selectByExample(example);
|
List<Organization> organizations = organizationMapper.selectByExample(example);
|
||||||
if (CollectionUtils.isEmpty(organizations)) {
|
|
||||||
throw new MSException(Translator.get("organization_default_not_exists"));
|
|
||||||
}
|
|
||||||
Organization organization = organizations.get(0);
|
Organization organization = organizations.get(0);
|
||||||
BeanUtils.copyBean(organizationDTO, organization);
|
BeanUtils.copyBean(organizationDTO, organization);
|
||||||
return organizationDTO;
|
return organizationDTO;
|
||||||
|
|
|
@ -21,6 +21,7 @@ import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
|
||||||
import org.springframework.test.web.servlet.result.MockMvcResultHandlers;
|
import org.springframework.test.web.servlet.result.MockMvcResultHandlers;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.Collections;
|
||||||
|
|
||||||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
|
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
|
||||||
|
|
||||||
|
@ -91,7 +92,7 @@ public class OrganizationControllerTests extends BaseTest{
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Order(4)
|
@Order(4)
|
||||||
public void testAddOrganizationMember() throws Exception {
|
public void testAddOrganizationMemberPass() throws Exception {
|
||||||
OrganizationMemberRequest organizationMemberRequest = new OrganizationMemberRequest();
|
OrganizationMemberRequest organizationMemberRequest = new OrganizationMemberRequest();
|
||||||
organizationMemberRequest.setOrganizationId("default-organization-3");
|
organizationMemberRequest.setOrganizationId("default-organization-3");
|
||||||
organizationMemberRequest.setMemberIds(Arrays.asList("admin", "default-admin"));
|
organizationMemberRequest.setMemberIds(Arrays.asList("admin", "default-admin"));
|
||||||
|
@ -105,6 +106,20 @@ public class OrganizationControllerTests extends BaseTest{
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Order(5)
|
@Order(5)
|
||||||
|
public void testAddOrganizationMemberNotPass() throws Exception {
|
||||||
|
OrganizationMemberRequest organizationMemberRequest = new OrganizationMemberRequest();
|
||||||
|
organizationMemberRequest.setOrganizationId("default-organization-3");
|
||||||
|
organizationMemberRequest.setMemberIds(Collections.emptyList());
|
||||||
|
mockMvc.perform(MockMvcRequestBuilders.post(REQ_PREFIX + "/add-member")
|
||||||
|
.header(SessionConstants.HEADER_TOKEN, sessionId)
|
||||||
|
.header(SessionConstants.CSRF_TOKEN, csrfToken)
|
||||||
|
.content(JSON.toJSONString(organizationMemberRequest))
|
||||||
|
.contentType(MediaType.APPLICATION_JSON))
|
||||||
|
.andExpect(status().isBadRequest());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@Order(6)
|
||||||
public void testRemoveOrganizationMember() throws Exception {
|
public void testRemoveOrganizationMember() throws Exception {
|
||||||
mockMvc.perform(MockMvcRequestBuilders.get(REQ_PREFIX + "/remove-member/default-organization-3/admin")
|
mockMvc.perform(MockMvcRequestBuilders.get(REQ_PREFIX + "/remove-member/default-organization-3/admin")
|
||||||
.header(SessionConstants.HEADER_TOKEN, sessionId)
|
.header(SessionConstants.HEADER_TOKEN, sessionId)
|
||||||
|
@ -113,7 +128,7 @@ public class OrganizationControllerTests extends BaseTest{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Order(6)
|
@Order(7)
|
||||||
public void testGetOrganizationProject() throws Exception {
|
public void testGetOrganizationProject() throws Exception {
|
||||||
ProjectRequest projectRequest = new ProjectRequest();
|
ProjectRequest projectRequest = new ProjectRequest();
|
||||||
projectRequest.setCurrent(1);
|
projectRequest.setCurrent(1);
|
||||||
|
|
Loading…
Reference in New Issue