@Test
  public void define_close_action() throws Exception {
    WebService.Controller controller = tester.controller("api/action_plans");

    WebService.Action action = controller.action("close");
    assertThat(action).isNotNull();
    assertThat(action.handler()).isInstanceOf(RailsHandler.class);
    assertThat(action.params()).hasSize(2);
  }
  @Test
  public void define_remove_action() throws Exception {
    WebService.Controller controller = tester.controller("api/permissions");

    WebService.Action action = controller.action("remove");
    assertThat(action).isNotNull();
    assertThat(action.handler()).isInstanceOf(RailsHandler.INSTANCE.getClass());
    assertThat(action.params()).hasSize(5);
  }
  @Test
  public void define_search_action() throws Exception {
    WebService.Controller controller = tester.controller("api/action_plans");

    WebService.Action action = controller.action("search");
    assertThat(action).isNotNull();
    assertThat(action.handler()).isInstanceOf(RailsHandler.class);
    assertThat(action.responseExampleAsString()).isNotEmpty();
    assertThat(action.params()).hasSize(2);
  }
 @Test
 public void define_suggestions_action() throws Exception {
   WebService.Action action = controller.action("suggestions");
   assertThat(action).isNotNull();
   assertThat(action.isInternal()).isTrue();
   assertThat(action.isPost()).isFalse();
   assertThat(action.handler()).isInstanceOf(RailsHandler.class);
   assertThat(action.responseExampleAsString()).isNotEmpty();
   assertThat(action.params()).hasSize(2);
 }
示例#5
0
  @Test
  public void action_update_is_defined() {
    WsTester wsTester = new WsTester();
    WebService.NewController newController =
        wsTester.context().createController(DUMMY_CONTROLLER_KEY);

    underTest.define(newController);
    newController.done();

    WebService.Controller controller = wsTester.controller(DUMMY_CONTROLLER_KEY);
    assertThat(controller.actions()).extracting("key").containsExactly(ACTION_KEY);

    WebService.Action action = controller.actions().iterator().next();
    assertThat(action.isPost()).isTrue();
    assertThat(action.description()).isNotEmpty();
    assertThat(action.responseExample()).isNull();

    assertThat(action.params()).hasSize(1);
    WebService.Param key = action.param(KEY_PARAM);
    assertThat(key).isNotNull();
    assertThat(key.isRequired()).isTrue();
    assertThat(key.description()).isNotNull();
  }
示例#6
0
 @Test
 public void define() throws Exception {
   WebService.Action def = tester.getDef();
   assertThat(def.params()).isEmpty();
 }