Class UsersResourceTest
java.lang.Object
junit.framework.Assert
junit.framework.TestCase
com.atlassian.crowd.acceptance.tests.rest.service.RestCrowdServiceAcceptanceTestCase
com.atlassian.crowd.acceptance.tests.rest.service.UsersResourceTest
- All Implemented Interfaces:
junit.framework.Test
Tests UsersResource.
Note that this test class is reused in JIRA via inheritance. Please be mindful of that when making changes to this class.
-
Field Summary
Fields inherited from class com.atlassian.crowd.acceptance.tests.rest.service.RestCrowdServiceAcceptanceTestCase
ADMIN_PASSWORD, ADMIN_USERNAME, APPLICATION_NAME, APPLICATION_PASSWORD, ATTRIBUTES_RESOURCE, AUTHENTICATION_RESOURCE, EEEEP_PASSWORD, EEEEP_USERNAME, EVENTS_RESOURCE, GROUP_BADGERS, GROUP_BADGERS_DESCRIPTION, GROUP_CROWD_ADMINS, GROUP_CROWD_TESTERS, GROUP_CROWD_USERS, GROUPS_RESOURCE, MT, NON_ADMIN_USER_NAME, NON_ADMIN_USER_PASSWORD, NON_CROWD_USER_PASSWORD, NON_CROWD_USER_USERNAME, NON_EXISTENT_GROUP, NON_EXISTENT_USER, PENNY_USERNAME, REST_SERVICE_NAME, restServer, SECOND_ADMIN_PASSWORD, SECOND_ADMIN_USERNAME, SESSION_RESOURCE, USERS_RESOURCE, WEBHOOKS_RESOURCE
-
Constructor Summary
ConstructorDescriptionUsersResourceTest
(String name) Constructs a test case with the given name.UsersResourceTest
(String name, RestServer restServer) Constructs a test case with the given name, using the given RestServer. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Tests adding a new user.void
void
Tests that adding a user without providing a password will return a 400 (Bad Request) response.void
void
Tests adding a user to a group.void
void
Tests that adding a user to a non-existent group returns a 400 (Bad Request) response.void
Tests that adding a non-existent user to a group returns a 404 (Not Found) response.void
Tests adding a new user with attributes, and ensuring that they are stored correctly.void
void
Tests deleting a user.void
Tests deleting a user attribute.void
Tests that deleting a user's password restricts the user from logging in with their old password.void
void
void
void
void
void
void
void
void
Tests retrieving a nested group membership.void
void
void
void
Tests getting the nested groups.void
void
Tests retrieving a valid user.void
Tests that attempting to access the UserResource with an InvalidPassword returns a 401 (Unauthorized) response.void
Tests that retrieving a non-existent user returns a 404 (Not Found) response.void
void
Tests retrieving a user with attributes.void
void
Tests removing a user from a group.void
void
void
void
void
void
Test store user attributes.void
Tests that a user is successfully updated.void
Tests that sending an updated user with a wrong user URI (i.e.void
Tests updating a user password.void
void
void
Methods inherited from class com.atlassian.crowd.acceptance.tests.rest.service.RestCrowdServiceAcceptanceTestCase
authenticateUser, authenticateUser, deactivateUser, getBaseUriBuilder, getBaseUriBuilder, getBaseUriBuilder, getRootWebTarget, getServerUriBuilder, getWebTarget, getWebTarget, requestEvents, requestEventToken, setRestServer, setUp, tearDown
Methods inherited from class junit.framework.TestCase
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, countTestCases, createResult, fail, fail, failNotEquals, failNotSame, failSame, format, getName, run, run, runBare, runTest, setName, toString
-
Constructor Details
-
UsersResourceTest
Constructs a test case with the given name.- Parameters:
name
- the test name
-
UsersResourceTest
Constructs a test case with the given name, using the given RestServer.- Parameters:
name
- the test namerestServer
- the RestServer
-
-
Method Details
-
testGetUser
public void testGetUser()Tests retrieving a valid user. Checks that all the user details are correct. -
testGetUserByKey
public void testGetUserByKey() -
testGetUser_InvalidApplicationCredentials
public void testGetUser_InvalidApplicationCredentials()Tests that attempting to access the UserResource with an InvalidPassword returns a 401 (Unauthorized) response. -
testGetUser_NonExistent
public void testGetUser_NonExistent()Tests that retrieving a non-existent user returns a 404 (Not Found) response. -
testGetUserWithAttributes
public void testGetUserWithAttributes()Tests retrieving a user with attributes. -
testGetUserWithAttributesByKey
public void testGetUserWithAttributesByKey() -
testAddUser
Tests adding a new user.- Throws:
Exception
-
testAddUserWithAttributes
Tests adding a new user with attributes, and ensuring that they are stored correctly.- Throws:
Exception
-
testAddUser_NoPasswordProvided
public void testAddUser_NoPasswordProvided()Tests that adding a user without providing a password will return a 400 (Bad Request) response. -
testAddUser_AtlassianSecurityPasswordProvided
public void testAddUser_AtlassianSecurityPasswordProvided() -
testAddUser_UserAlreadyExists
- Throws:
Exception
-
testUpdateUser
public void testUpdateUser()Tests that a user is successfully updated. -
testUpdateUser_WrongUserUri
public void testUpdateUser_WrongUserUri()Tests that sending an updated user with a wrong user URI (i.e. a URI for another user) will return a 400 (Bad Request) response. -
testUpdateUserWithDifferentCaseInUrlIsAccepted
public void testUpdateUserWithDifferentCaseInUrlIsAccepted() -
testUpdateUserWithDifferentCaseInEntityIsAccepted
public void testUpdateUserWithDifferentCaseInEntityIsAccepted() -
testUpdateUserWithDifferentEntityNameShouldNotRenameUser
public void testUpdateUserWithDifferentEntityNameShouldNotRenameUser() -
testRenameUserShouldRenameUserWhenProvidedWithOldUsername
public void testRenameUserShouldRenameUserWhenProvidedWithOldUsername() -
testRenameUserShouldRenameUserWhenProvidedWithOldUsernameAndNewNameOfDifferentCase
public void testRenameUserShouldRenameUserWhenProvidedWithOldUsernameAndNewNameOfDifferentCase() -
testRenameUserShouldFailWhenUserWithProvidedUsernameDoesNotExist
public void testRenameUserShouldFailWhenUserWithProvidedUsernameDoesNotExist() -
testRenameUserShouldFailWhenNewUsernameIsAlreadyInUse
public void testRenameUserShouldFailWhenNewUsernameIsAlreadyInUse() -
testUpdateUserPassword
public void testUpdateUserPassword()Tests updating a user password. -
testDeleteUserPasswordRejectsOldPassword
public void testDeleteUserPasswordRejectsOldPassword()Tests that deleting a user's password restricts the user from logging in with their old password. -
testStoreUserAttributes
public void testStoreUserAttributes()Test store user attributes. -
testDeleteUserAttribute
public void testDeleteUserAttribute()Tests deleting a user attribute. -
testDeleteNonExistentUserAttributeSucceeds
public void testDeleteNonExistentUserAttributeSucceeds() -
testDeleteUser
public void testDeleteUser()Tests deleting a user. -
testExpireAllPasswords
public void testExpireAllPasswords() -
testAddUserToGroup
public void testAddUserToGroup()Tests adding a user to a group. -
testAddUserToGroup_NonExistentGroup
public void testAddUserToGroup_NonExistentGroup()Tests that adding a user to a non-existent group returns a 400 (Bad Request) response. -
testAddUserToGroup_NonExistentUser
public void testAddUserToGroup_NonExistentUser()Tests that adding a non-existent user to a group returns a 404 (Not Found) response. -
testAddUserToGroup_MembershipAlreadyExists
public void testAddUserToGroup_MembershipAlreadyExists() -
testRemoveUserFromGroup
public void testRemoveUserFromGroup()Tests removing a user from a group. -
testGetNestedGroup
public void testGetNestedGroup()Tests retrieving a nested group membership. -
testGetNestedGroups
public void testGetNestedGroups()Tests getting the nested groups. -
testGetNestedGroupReturns404WhenGroupDoesNotExist
public void testGetNestedGroupReturns404WhenGroupDoesNotExist() -
testGetNestedGroupReturns404WhenUserDoesNotExist
public void testGetNestedGroupReturns404WhenUserDoesNotExist() -
testGetNestedGroupReturns404WhenUserAndGroupDoNotExist
public void testGetNestedGroupReturns404WhenUserAndGroupDoNotExist() -
testGetNestedGroupsReturns404WhenUserDoesNotExist
public void testGetNestedGroupsReturns404WhenUserDoesNotExist() -
testGetDirectGroup
public void testGetDirectGroup() -
testGetDirectGroups
public void testGetDirectGroups() -
testGetDirectGroupReturns404WhenGroupDoesNotExist
public void testGetDirectGroupReturns404WhenGroupDoesNotExist() -
testGetDirectGroupReturns404WhenUserDoesNotExist
public void testGetDirectGroupReturns404WhenUserDoesNotExist() -
testGetDirectGroupReturns404WhenUserAndGroupDoNotExist
public void testGetDirectGroupReturns404WhenUserAndGroupDoNotExist() -
testGetDirectGroupsReturns404WhenUserDoesNotExist
public void testGetDirectGroupsReturns404WhenUserDoesNotExist() -
testGetDirectGroupsWithAttributes
public void testGetDirectGroupsWithAttributes() -
testRequestForAvatarForUnspecifiedUserIsNotFound
public void testRequestForAvatarForUnspecifiedUserIsNotFound()
-