@Test public void deleteTemplate_does_POST_on_Ws_delete_template() { underTest.deleteTemplate( new DeleteTemplateWsRequest() .setTemplateId(TEMPLATE_ID_VALUE) .setTemplateName(TEMPLATE_NAME_VALUE)); assertThat(serviceTester.getPostParser()).isNull(); PostRequest postRequest = serviceTester.getPostRequest(); serviceTester .assertThat(postRequest) .hasPath("delete_template") .hasParam(PARAM_TEMPLATE_ID, TEMPLATE_ID_VALUE) .hasParam(PARAM_TEMPLATE_NAME, TEMPLATE_NAME_VALUE) .andNoOtherParam(); }
@Test public void setDefaultTemplate_does_POST_on_Ws_set_default_template() { underTest.setDefaultTemplate( new SetDefaultTemplateWsRequest() .setQualifier(QUALIFIER_VALUE) .setTemplateId(TEMPLATE_ID_VALUE) .setTemplateName(TEMPLATE_NAME_VALUE)); assertThat(serviceTester.getPostParser()).isNull(); PostRequest postRequest = serviceTester.getPostRequest(); serviceTester .assertThat(postRequest) .hasPath("set_default_template") .hasParam(PARAM_QUALIFIER, QUALIFIER_VALUE) .hasParam(PARAM_TEMPLATE_ID, TEMPLATE_ID_VALUE) .hasParam(PARAM_TEMPLATE_NAME, TEMPLATE_NAME_VALUE) .andNoOtherParam(); }
@Test public void createTemplate_does_POST_on_Ws_create_template() { underTest.createTemplate( new CreateTemplateWsRequest() .setName(NAME_VALUE) .setDescription(DESCRIPTION_VALUE) .setProjectKeyPattern(PROJECT_KEY_PATTERN_VALUE)); assertThat(serviceTester.getPostParser()) .isSameAs(WsPermissions.CreateTemplateWsResponse.parser()); PostRequest postRequest = serviceTester.getPostRequest(); serviceTester .assertThat(postRequest) .hasPath("create_template") .hasParam(PARAM_NAME, NAME_VALUE) .hasParam(PARAM_DESCRIPTION, DESCRIPTION_VALUE) .hasParam(PARAM_PROJECT_KEY_PATTERN, PROJECT_KEY_PATTERN_VALUE) .andNoOtherParam(); }
@Test public void removeUserFromTemplate_does_POST_on_Ws_remove_user_from_template() { underTest.removeUserFromTemplate( new RemoveUserFromTemplateWsRequest() .setPermission(PERMISSION_VALUE) .setLogin(LOGIN_VALUE) .setTemplateId(TEMPLATE_ID_VALUE) .setTemplateName(TEMPLATE_NAME_VALUE)); assertThat(serviceTester.getPostParser()).isNull(); PostRequest postRequest = serviceTester.getPostRequest(); serviceTester .assertThat(postRequest) .hasPath("remove_user_from_template") .hasParam(PARAM_PERMISSION, PERMISSION_VALUE) .hasParam(PARAM_USER_LOGIN, LOGIN_VALUE) .hasParam(PARAM_TEMPLATE_ID, TEMPLATE_ID_VALUE) .hasParam(PARAM_TEMPLATE_NAME, TEMPLATE_NAME_VALUE) .andNoOtherParam(); }
@Test public void removeUser_does_POST_on_Ws_remove_user() { underTest.removeUser( new RemoveUserWsRequest() .setPermission(PERMISSION_VALUE) .setLogin(LOGIN_VALUE) .setProjectId(PROJECT_ID_VALUE) .setProjectKey(PROJECT_KEY_VALUE)); assertThat(serviceTester.getPostParser()).isNull(); PostRequest postRequest = serviceTester.getPostRequest(); serviceTester .assertThat(postRequest) .hasPath("remove_user") .hasParam(PARAM_PERMISSION, PERMISSION_VALUE) .hasParam(PARAM_USER_LOGIN, LOGIN_VALUE) .hasParam(PARAM_PROJECT_ID, PROJECT_ID_VALUE) .hasParam(PARAM_PROJECT_KEY, PROJECT_KEY_VALUE) .andNoOtherParam(); }
@Test public void applyTemplate_does_POST_on_Ws_apply_template() { underTest.applyTemplate( new ApplyTemplateWsRequest() .setProjectId(PROJECT_ID_VALUE) .setProjectKey(PROJECT_KEY_VALUE) .setTemplateId(TEMPLATE_ID_VALUE) .setTemplateName(TEMPLATE_NAME_VALUE)); assertThat(serviceTester.getPostParser()).isNull(); PostRequest postRequest = serviceTester.getPostRequest(); serviceTester .assertThat(postRequest) .hasPath("apply_template") .hasParam(PARAM_PROJECT_ID, PROJECT_ID_VALUE) .hasParam(PARAM_PROJECT_KEY, PROJECT_KEY_VALUE) .hasParam(PARAM_TEMPLATE_ID, TEMPLATE_ID_VALUE) .hasParam(PARAM_TEMPLATE_NAME, TEMPLATE_NAME_VALUE) .andNoOtherParam(); }
@Test public void removeGroup_does_POST_on_Ws_remove_group() { underTest.removeGroup( new RemoveGroupWsRequest() .setPermission(PERMISSION_VALUE) .setGroupId(GROUP_ID_VALUE) .setGroupName(GROUP_NAME_VALUE) .setProjectId(PROJECT_ID_VALUE) .setProjectKey(PROJECT_KEY_VALUE)); assertThat(serviceTester.getPostParser()).isNull(); PostRequest postRequest = serviceTester.getPostRequest(); serviceTester .assertThat(postRequest) .hasPath("remove_group") .hasParam(PARAM_PERMISSION, PERMISSION_VALUE) .hasParam(PARAM_GROUP_ID, GROUP_ID_VALUE) .hasParam(PARAM_GROUP_NAME, GROUP_NAME_VALUE) .hasParam(PARAM_PROJECT_ID, PROJECT_ID_VALUE) .hasParam(PARAM_PROJECT_KEY, PROJECT_KEY_VALUE) .andNoOtherParam(); }
@Test public void addGroupToTemplate_does_POST_on_Ws_add_group_to_template() { underTest.addGroupToTemplate( new AddGroupToTemplateWsRequest() .setGroupId(GROUP_ID_VALUE) .setGroupName(GROUP_NAME_VALUE) .setPermission(PERMISSION_VALUE) .setTemplateId(TEMPLATE_ID_VALUE) .setTemplateName(TEMPLATE_NAME_VALUE)); assertThat(serviceTester.getPostParser()).isNull(); PostRequest postRequest = serviceTester.getPostRequest(); serviceTester .assertThat(postRequest) .hasPath("add_group_to_template") .hasParam(PARAM_GROUP_ID, GROUP_ID_VALUE) .hasParam(PARAM_GROUP_NAME, GROUP_NAME_VALUE) .hasParam(PARAM_PERMISSION, PERMISSION_VALUE) .hasParam(PARAM_TEMPLATE_ID, TEMPLATE_ID_VALUE) .hasParam(PARAM_TEMPLATE_NAME, TEMPLATE_NAME_VALUE) .andNoOtherParam(); }