'Test the basic ExecutePython action.'

def testExecutePythonEnvironment(self):

    python_code = '\nimport    StringIO\nimport    uu\n\ndef    decode(encoded):\n        #    Use    the    import    (uu)    inside    a    function.    This    will    fail    if    the    environment\n        #    for    exec    is    not    set    up    properly.\n        i    =    StringIO.StringIO(s)\n        o    =    StringIO.StringIO()\n        uu.decode(i,    o)\n        return    o.getvalue()\n\ns    =    "626567696e20363636202d0a2c3226354c3b265c4035565d523b2630410a200a656e640a"\ns    =    s.decode("hex")\n\nmagic_return_str    =    decode(s)\n'
    signed_blob = rdf_crypto.SignedBlob()
    signed_blob.Sign(python_code, self.signing_key)
    request = rdf_client.ExecutePythonRequest(python_code=signed_blob)
    result = self.RunAction(standard.ExecutePython, request)[0]
    self.assertTrue((result.time_used > 0))
    self.assertEqual(result.return_val, 'Hello    World!')
