'Test S3PopupLink'

def testPopupLink(self):

    auth = current.auth
    deployment_settings = current.deployment_settings
    comment = S3PopupLink(c='pr', f='person')
    self.assertEqual(comment.check_active(), deployment_settings.has_module('pr'))
    self.assertEqual(comment.method, 'create')
    from s3.s3crud import S3CRUD
    crud_string = S3CRUD.crud_string('pr_person', 'label_create')
    self.assertEqual(comment.label, crud_string)
    if ('inv' in deployment_settings.modules):
        comment = S3PopupLink(c='inv', f='inv_item')
        inv = deployment_settings.modules['inv']
        del deployment_settings.modules['inv']
        self.assertFalse(comment.check_active())
        deployment_settings.modules['inv'] = inv
        self.assertTrue(comment.check_active())
    self.assertFalse(comment.check_permission())
    self.assertEqual(comment.xml(), '')
    auth.s3_impersonate('admin@example.com')
    self.assertTrue(comment.check_permission())
    output = comment.xml()
    self.assertTrue((type(output) is str))
    self.assertNotEqual(output, '')
    auth.s3_impersonate(None)
