def testCreateName(self):
     self.assertEqual(createUserName("First", "Last", "101", 21), "101.wcpe.sagebase.org")
     self.assertEqual(createUserName("First", "Last", "101", 22), "101.wcpe.sagebase.org")
     self.assertEqual(createUserName("First", "Last", "101", 23), "l.101.wcpe.sagebase.org")
     self.assertEqual(createUserName("First", "Last", "101", 26), "last.101.wcpe.sagebase.org")
     self.assertEqual(createUserName("First", "Last", "101", 27), "last.101.wcpe.sagebase.org")
     self.assertEqual(createUserName("First", "Last", "101", 28), "f.last.101.wcpe.sagebase.org")
     self.assertEqual(createUserName("First", "Last", "101", 29), "fi.last.101.wcpe.sagebase.org")
     self.assertEqual(createUserName("First", "Last", "101", 32), "first.last.101.wcpe.sagebase.org")
     self.assertEqual(createUserName("First", "Last", "101", 33), "first.last.101.wcpe.sagebase.org")
     self.assertEqual(createUserName("First", "Last", "101", 100), "first.last.101.wcpe.sagebase.org")
     
     self.assertEqual(createUserName("Fi@#$%rst", "L.-_", "101", 100), "first.l.-_.101.wcpe.sagebase.org")
    def testCreateName(self):
        self.assertEqual(createUserName("First", "Last", "101", 21),
                         "101.wcpe.sagebase.org")
        self.assertEqual(createUserName("First", "Last", "101", 22),
                         "101.wcpe.sagebase.org")
        self.assertEqual(createUserName("First", "Last", "101", 23),
                         "l.101.wcpe.sagebase.org")
        self.assertEqual(createUserName("First", "Last", "101", 26),
                         "last.101.wcpe.sagebase.org")
        self.assertEqual(createUserName("First", "Last", "101", 27),
                         "last.101.wcpe.sagebase.org")
        self.assertEqual(createUserName("First", "Last", "101", 28),
                         "f.last.101.wcpe.sagebase.org")
        self.assertEqual(createUserName("First", "Last", "101", 29),
                         "fi.last.101.wcpe.sagebase.org")
        self.assertEqual(createUserName("First", "Last", "101", 32),
                         "first.last.101.wcpe.sagebase.org")
        self.assertEqual(createUserName("First", "Last", "101", 33),
                         "first.last.101.wcpe.sagebase.org")
        self.assertEqual(createUserName("First", "Last", "101", 100),
                         "first.last.101.wcpe.sagebase.org")

        self.assertEqual(createUserName("Fi@#$%rst", "L.-_", "101", 100),
                         "first.l.-_.101.wcpe.sagebase.org")
ownPrincipalId = ownUserProfile['ownerId']

## get all Participants for Evaluation
participants = syn.restGET("/evaluation/"+evaluationId+'/participant?limit=99999')['results']
print "total number of results: "+str(len(participants))

## For each participant
participantList = []
anyNewUsers = False
for i,part in enumerate(participants):
    ## add to a list the user's first name, last name, email address, user name and principal ID
    ## "user name" is defined as <firstName>.<lastName>.<principalId>.wcpe.sagebase.org
    partId = part['userId']
    up = syn.getUserProfile(partId)
    # scrub for illegal characters, control string length, convert to lower case
    userName = createUserName(up['firstName'], up['lastName'], partId, MAXIMUM_USER_NAME_LENGTH)
    participantList.append({'firstName':up['firstName'], 'lastName':up['lastName'], 'email':up['email'], 'userName':userName, 'bucketName':userName, 'principalId':partId})
    print userName
    
    # Ensure user exists
    ## Create a IAM user for that participant's aws account.
    indexOfAccountForUser = findUser(userName, iamConnections)
    if (indexOfAccountForUser<0):
        # user does not exist
        anyNewUsers=True
        print "\t"+userName+" is a new user"
        # need to create user in an account that can accommodate a new bucket
        indexOfAccountForUser = findBucketSpace(s3Connections)
        if (indexOfAccountForUser<0):
            raise("No account has room for a new bucket!")
        iamConnections[indexOfAccountForUser].create_user(userName)
ownPrincipalId = ownUserProfile["ownerId"]

## get all Participants for Evaluation
participants = syn.restGET("/evaluation/" + evaluationId + "/participant?limit=99999")["results"]
print "total number of results: " + str(len(participants))

## For each participant
participantList = []
anyNewUsers = False
for i, part in enumerate(participants):
    ## add to a list the user's first name, last name, email address, user name and principal ID
    ## "user name" is defined as <firstName>.<lastName>.<principalId>.wcpe.sagebase.org
    partId = part["userId"]
    up = syn.getUserProfile(partId)
    # scrub for illegal characters, control string length, convert to lower case
    userName = createUserName(up["firstName"], up["lastName"], partId, MAXIMUM_USER_NAME_LENGTH)
    participantList.append(
        {
            "firstName": up["firstName"],
            "lastName": up["lastName"],
            "email": up["email"],
            "userName": userName,
            "bucketName": userName,
            "principalId": partId,
        }
    )
    print userName

    # Ensure user exists
    ## Create a IAM user for that participant's aws account.
    indexOfAccountForUser = findUser(userName, iamConnections)