Formatting, change test names

This commit is contained in:
Valentin Popa
2016-09-02 16:57:19 +03:00
parent 932ddb2e02
commit 5bb07e9f4d
4 changed files with 50 additions and 42 deletions

View File

@@ -47,13 +47,14 @@ public class RestDemoTest extends RestTest
* @throws Exception
*/
@Test
public void sitesTest() throws JsonToModelConversionException, Exception
public void adminRetrievesCorrectSiteDetails() throws JsonToModelConversionException, Exception
{
sitesApi.getAllSites().assertThatResponseHasSite(siteModel)
.getSite(siteModel)
.assertSiteHasVisibility(Visibility.PUBLIC)
.assertSiteHasTitle(siteModel.getTitle())
.assertSiteHasDescription(siteModel.getDescription());
sitesApi.getAllSites()
.assertThatResponseHasSite(siteModel)
.getSite(siteModel)
.assertSiteHasVisibility(Visibility.PUBLIC)
.assertSiteHasTitle(siteModel.getTitle())
.assertSiteHasDescription(siteModel.getDescription());
}
/**
@@ -64,7 +65,7 @@ public class RestDemoTest extends RestTest
* @throws Exception
*/
@Test
public void commentsTest() throws Exception
public void adminCanPostAndUpdateComments() throws Exception
{
FileModel fileModel = dataContent.usingResource("Shared")
.usingUser(userModel)
@@ -72,18 +73,18 @@ public class RestDemoTest extends RestTest
// add new comment
RestCommentModel commentEntry = commentsAPI.addComment(fileModel.getNodeRef(), "This is a new comment");
commentsAPI.getNodeComments(fileModel.getNodeRef())
.assertThatResponseIsNotEmpty()
.assertThatCommentWithIdExists(commentEntry.getId())
.assertThatCommentWithContentExists("This is a new comment");
.assertThatResponseIsNotEmpty()
.assertThatCommentWithIdExists(commentEntry.getId())
.assertThatCommentWithContentExists("This is a new comment");
// update comment
commentEntry = commentsAPI.updateComment(fileModel.getNodeRef(),
commentEntry.getId(),
"This is the updated comment");
commentsAPI.getNodeComments(fileModel.getNodeRef())
.assertThatResponseIsNotEmpty()
.assertThatCommentWithIdExists(commentEntry.getId())
.assertThatCommentWithContentExists("This is the updated comment");
.assertThatResponseIsNotEmpty()
.assertThatCommentWithIdExists(commentEntry.getId())
.assertThatCommentWithContentExists("This is the updated comment");
}
/**
@@ -96,29 +97,32 @@ public class RestDemoTest extends RestTest
* @throws JsonToModelConversionException
*/
@Test
public void siteMembersTest() throws Exception
public void adminCanAddAndUpdateSiteMemberDetails() throws Exception
{
UserModel newUser = dataUser.createRandomTestUser();
SiteMember siteMember = new SiteMember(Role.SiteConsumer.toString(), newUser.getUsername());
SiteMember siteMember = new SiteMember(Role.SiteConsumer.toString(),
newUser.getUsername());
// add user as Consumer to site
sitesApi.addPerson(siteModel.getId(), siteMember);
sitesApi.getSiteMembers(siteModel.getId())
.assertThatSiteHasMember(siteMember.getId())
.getSiteMember(siteMember.getId())
.assertSiteMemberHasRole(Role.SiteConsumer);
.assertThatSiteHasMember(siteMember.getId())
.getSiteMember(siteMember.getId())
.assertSiteMemberHasRole(Role.SiteConsumer);
// update site member to Manager
siteMember.setRole(Role.SiteManager.toString());
;
sitesApi.updateSiteMember(siteModel.getId(), newUser.getUsername(), siteMember);
sitesApi.updateSiteMember(siteModel.getId(),
newUser.getUsername(), siteMember);
sitesApi.getSiteMembers(siteModel.getId())
.assertThatSiteHasMember(siteMember.getId())
.getSiteMember(siteMember.getId())
.assertSiteMemberHasRole(Role.SiteManager);
.assertThatSiteHasMember(siteMember.getId())
.getSiteMember(siteMember.getId())
.assertSiteMemberHasRole(Role.SiteManager);
// delete site member
sitesApi.deleteSiteMember(siteModel.getId(), newUser.getUsername());
sitesApi.usingRestWrapper().assertStatusCodeIs(HttpStatus.NO_CONTENT.toString());
sitesApi.deleteSiteMember(siteModel.getId(),
newUser.getUsername());
sitesApi.usingRestWrapper()
.assertStatusCodeIs(HttpStatus.NO_CONTENT.toString());
}
}

View File

@@ -35,7 +35,7 @@ public class SampleCommentsTest extends RestTest
}
@Test
public void addComments() throws JsonToModelConversionException, Exception
public void adminIsAbleToAddComment() throws JsonToModelConversionException, Exception
{
commentsAPI.addComment(document.getNodeRef(), "This is a new comment");
commentsAPI.usingRestWrapper()
@@ -43,7 +43,7 @@ public class SampleCommentsTest extends RestTest
}
@Test
public void getCommentsCheckStatusCode() throws JsonToModelConversionException
public void adminIsAbleToRetrieveComments() throws JsonToModelConversionException
{
commentsAPI.getNodeComments(document.getNodeRef());
commentsAPI.usingRestWrapper()
@@ -51,13 +51,15 @@ public class SampleCommentsTest extends RestTest
}
@Test
public void updateComment() throws JsonToModelConversionException, Exception
public void adminIsAbleToUpdateComment() throws JsonToModelConversionException, Exception
{
// add initial comment
String commentId = commentsAPI.addComment(document.getNodeRef(), "This is a new comment").getId();
// update comment
RestCommentModel commentEntry = commentsAPI.updateComment(document.getNodeRef(), commentId, "This is the updated comment");
RestCommentModel commentEntry = commentsAPI.updateComment(document.getNodeRef(),
commentId,
"This is the updated comment");
commentEntry.assertCommentContentIs("This is the updated comment");
}

View File

@@ -18,17 +18,19 @@ public class SamplePeopleTest extends RestTest
DataUser dataUser;
private UserModel userModel;
private UserModel adminUser;
@BeforeClass
public void setUp() throws DataPreparationException
{
userModel = dataUser.createUser(RandomStringUtils.randomAlphanumeric(20));
restClient.authenticateUser(userModel);
adminUser = dataUser.getAdminUser();
restClient.authenticateUser(adminUser);
peopleAPI.useRestClient(restClient);
}
@Test
public void getPersonCheckResponseAndStatus() throws Exception
public void adminIsAbleToRetrievePerson() throws Exception
{
peopleAPI.getPerson(userModel.getUsername())
.assertResponseIsNotEmpty();
@@ -38,10 +40,10 @@ public class SamplePeopleTest extends RestTest
}
@Test
public void getPersonCheckStatusCode1() throws Exception
public void adminIsAbleToRetrieveItself() throws Exception
{
peopleAPI.getPerson(userModel.getUsername())
.assertPersonHasName(userModel.getUsername());
peopleAPI.getPerson(adminUser.getUsername())
.assertPersonHasName(adminUser.getUsername());
}
}

View File

@@ -37,13 +37,13 @@ public class SampleSitesTest extends RestTest
}
@Test
public void getSiteResponseNotNull() throws JsonToModelConversionException, Exception
public void adminCanGetSiteDetails() throws JsonToModelConversionException, Exception
{
siteAPI.getSite(siteModel.getId()).assertResponseIsNotEmpty();
}
@Test
public void getSiteCheckStatusCode() throws JsonToModelConversionException, Exception
public void adminCanAccessSiteDetails() throws JsonToModelConversionException, Exception
{
siteAPI.getSite(siteModel.getId());
siteAPI.usingRestWrapper()
@@ -51,14 +51,14 @@ public class SampleSitesTest extends RestTest
}
@Test
public void getSitesResponseNotEmpty() throws JsonToModelConversionException, Exception
public void adminCanAccessSites() throws JsonToModelConversionException, Exception
{
siteAPI.getSites()
.assertThatResponseIsNotEmpty();
}
@Test
public void getSitesCheckStatusCode() throws JsonToModelConversionException, Exception
public void adminIsAbleToRetrieveSites() throws JsonToModelConversionException, Exception
{
siteAPI.getSites();
siteAPI.usingRestWrapper()
@@ -66,13 +66,13 @@ public class SampleSitesTest extends RestTest
}
@Test
public void sitesCollectionHasPagination() throws JsonToModelConversionException, Exception
public void adminIsAbleToAccessResponsePagination() throws JsonToModelConversionException, Exception
{
siteAPI.getSites().assertResponseHasPagination();
}
@Test
public void addMemberToSiteCheckStatusCode() throws JsonToModelConversionException, DataPreparationException, Exception
public void adminIsAbleToAddNewSiteMember() throws JsonToModelConversionException, DataPreparationException, Exception
{
UserModel newMember = dataUser.createRandomTestUser();
SiteMember siteMember = new SiteMember(Role.SiteCollaborator.toString(),
@@ -84,14 +84,14 @@ public class SampleSitesTest extends RestTest
}
@Test
public void isSiteReturned() throws JsonToModelConversionException, Exception
public void adminIsAbleToGetSiteFromSitesList() throws JsonToModelConversionException, Exception
{
siteAPI.getAllSites()
.assertThatResponseHasSite(siteModel.getId());
}
@Test
public void checkSiteDetails() throws JsonToModelConversionException, Exception
public void adminIsAbleToAccessSiteDetails() throws JsonToModelConversionException, Exception
{
siteAPI.getSite(siteModel.getId())
.assertResponseIsNotEmpty()