'Test set_roles with policy 4'

def testSetRolesPolicy4(self):

    auth = current.auth
    settings = current.deployment_settings
    settings.security.policy = 4
    auth.permission = S3Permission(auth)
    assertEqual = self.assertEqual
    assertTrue = self.assertTrue
    auth.s3_impersonate('normaluser@example.com')
    realms = auth.user.realms.keys()
    assertTrue((2 in realms))
    assertTrue((3 in realms))
    assertEqual(len(realms), 2)
    for r in auth.user.realms:
        assertEqual(auth.user.realms[r], None)
    auth.s3_impersonate(None)
