@Test
 public void newProject() {
   Result result =
       callAction(
           controllers.routes.ref.Projects.add(),
           fakeRequest()
               .withSession("email", "*****@*****.**")
               .withFormUrlEncodedBody(ImmutableMap.of("group", "Some Group")));
   assertEquals(200, status(result));
   Project project = Project.find.where().eq("folder", "Some Group").findUnique();
   assertNotNull(project);
   assertEquals("New project", project.name);
   assertEquals(1, project.members.size());
   assertEquals("*****@*****.**", project.members.get(0).email);
 }
 @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);
 }
Example #3
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);
 }