Example #1
0
 @Test
 public void testGet() {
   models.Channel channel = Channel.find.all().get(0);
   Result result =
       callAction(
           controllers.routes.ref.Channels.get(channel.id), new FakeRequest(GET, "/channels/1"));
   assertThat(status(result)).isEqualTo(OK);
   assertThat(contentAsString(result)).contains(channel.id.toString());
 }
Example #2
0
 @Test
 public void testDelete() {
   models.Channel channel = Channel.find.all().get(0);
   Result result =
       callAction(
           controllers.routes.ref.Channels.delete(channel.id),
           new FakeRequest(GET, "/channels/1/delete"));
   models.Channel channel2 = Channel.find.byId(channel.id);
   assertThat(channel2).isNull();
   assertThat(status(result)).isEqualTo(OK);
   assertThat(contentAsString(result)).isEmpty();
 }
Example #3
0
 @Test
 public void testAll() {
   models.Channel channel = new models.Channel();
   channel.title = "All Things v9";
   channel.link = "http://anthonyeden.com/rss.xml";
   channel.description = "Words from Anthony Eden, Founder of DNSimple";
   channel.save();
   Result result =
       callAction(controllers.routes.ref.Channels.all(), new FakeRequest(GET, "/channels"));
   assertThat(status(result)).isEqualTo(OK);
   assertThat(contentType(result)).isEqualTo("application/json");
   assertThat(charset(result)).isEqualTo("utf-8");
   assertThat(contentAsString(result)).contains("Anthony");
 }
Example #4
0
 @Test
 public void testCreate() {
   Map<String, String> params = new HashMap();
   params.put("title", "All Things v9");
   params.put("link", "http://anthonyeden.com/rss.xml");
   params.put("description", "Words from Anthony Eden, Founder of DNSimple");
   Result result =
       callAction(
           controllers.routes.ref.Channels.create(),
           new FakeRequest(POST, "/channels/create").withFormUrlEncodedBody(params));
   assertThat(status(result)).isEqualTo(OK);
   assertThat(contentType(result)).isEqualTo("application/json");
   assertThat(charset(result)).isEqualTo("utf-8");
   assertThat(contentAsString(result)).contains("Anthony");
 }