@Test
 public void renameProjectForbidden() {
   long id =
       Project.find
           .where()
           .eq("members.email", "*****@*****.**")
           .eq("name", "Tutorials")
           .findUnique()
           .id;
   Result result =
       callAction(
           controllers.routes.ref.Projects.rename(id),
           fakeRequest()
               .withSession("email", "*****@*****.**")
               .withFormUrlEncodedBody(ImmutableMap.of("name", "Private")));
   assertEquals(403, status(result));
   assertEquals("Tutorials", Project.find.byId(id).name);
 }
Пример #2
0
 @Test
 public void renameProject() {
   long id =
       Project.find
           .where()
           .eq("members.email", "*****@*****.**")
           .eq("name", "Private")
           .findUnique()
           .id;
   Result result =
       callAction(
           controllers.routes.ref.Projects.rename(id),
           fakeRequest()
               .withSession("email", "*****@*****.**")
               .withFormUrlEncodedBody(ImmutableMap.of("name", "New name")));
   assertEquals(200, status(result));
   assertEquals("New name", Project.find.byId(id).name);
 }