use of com.epam.ta.reportportal.ws.model.integration.IntegrationRQ in project service-api by reportportal.
the class IntegrationControllerTest method updateGlobalIntegration.
@Test
void updateGlobalIntegration() throws Exception {
IntegrationRQ request = new IntegrationRQ();
Map<String, Object> params = new HashMap<>();
params.put("param1", "value");
params.put("param2", "lalala");
request.setIntegrationParams(params);
request.setEnabled(true);
doNothing().when(emailService).testConnection();
mockMvc.perform(put("/v1/integration/7").with(token(oAuthHelper.getSuperadminToken())).contentType(MediaType.APPLICATION_JSON).content(objectMapper.writeValueAsBytes(request))).andExpect(status().isOk());
}
use of com.epam.ta.reportportal.ws.model.integration.IntegrationRQ in project service-api by reportportal.
the class IntegrationControllerTest method updateGlobalIntegrationNegative.
@Test
void updateGlobalIntegrationNegative() throws Exception {
IntegrationRQ request = new IntegrationRQ();
Map<String, Object> params = new HashMap<>();
params.put("param1", "value");
params.put("param2", "lalala");
request.setIntegrationParams(params);
request.setEnabled(true);
mockMvc.perform(put("/v1/integration/77").with(token(oAuthHelper.getSuperadminToken())).contentType(MediaType.APPLICATION_JSON).content(objectMapper.writeValueAsBytes(request))).andExpect(status().isNotFound());
}
use of com.epam.ta.reportportal.ws.model.integration.IntegrationRQ in project service-api by reportportal.
the class IntegrationControllerTest method createGlobalIntegration.
@Test
void createGlobalIntegration() throws Exception {
IntegrationRQ request = new IntegrationRQ();
request.setName("email");
Map<String, Object> params = new HashMap<>();
params.put("param1", "value");
params.put("param2", "lalala");
request.setIntegrationParams(params);
request.setEnabled(true);
doNothing().when(emailService).testConnection();
mockMvc.perform(post("/v1/integration/email").with(token(oAuthHelper.getSuperadminToken())).contentType(MediaType.APPLICATION_JSON).content(objectMapper.writeValueAsBytes(request))).andExpect(status().isCreated());
mockMvc.perform(post("/v1/integration/email").with(token(oAuthHelper.getSuperadminToken())).contentType(MediaType.APPLICATION_JSON).content(objectMapper.writeValueAsBytes(request))).andExpect(status().isConflict());
}
Aggregations