'Test s3_link_to_person with multiple user accounts'

def testMultipleUserRecords(self):

    auth = current.auth
    s3db = current.s3db
    assertEqual = self.assertEqual
    assertNotEqual = self.assertNotEqual
    assertTrue = self.assertTrue
    utable = auth.settings.table_user
    users = []
    user1 = Storage(first_name='TestLTPR1', last_name='User', email='testltpr1@example.com', password='XYZ')
    user_id = utable.insert(**user1)
    assertTrue((user_id is not None))
    user1['id'] = user_id
    users.append(user1)
    user2 = Storage(first_name='TestLTPR2', last_name='User', email='testltpr2@example.com', password='XYZ')
    user_id = utable.insert(**user2)
    assertTrue((user_id is not None))
    user2['id'] = user_id
    users.append(user2)
    user3 = Storage(first_name='TestLTPR3', last_name='User', email='testltpr3@example.com', password='XYZ')
    user_id = utable.insert(**user3)
    assertTrue((user_id is not None))
    user3['id'] = user_id
    users.append(user3)
    person_ids = auth.s3_link_to_person(users, self.org_id)
    assertTrue(isinstance(person_ids, list))
    assertEqual(len(person_ids), 3)
    auth.s3_impersonate('testltpr2@example.com')
    pe_id = auth.user.pe_id
    ptable = s3db.pr_person
    query = (ptable.pe_id == pe_id)
    person2 = current.db(query).select().first()
    assertNotEqual(person2, None)
    assertTrue((person2.id in person_ids))
