Cannot change properties area context to 'TEXTURE'

I’m trying to use a texture operator (bpy.ops.texture.slot_move) but it can only be called on properties area with texture context. I’m trying with the code below but it always gives me error when switching context.

The code:

import bpy

area = bpy.context.area
old_type = area.type
area.type = 'PROPERTIES'
area.spaces[0].context = 'TEXTURE'
bpy.ops.texture.slot_move(type='UP')
area.type = old_type

The error:

File "E:\context_madness.blend\Text", line 6 in <module>
TypeError: bpy_struct: item.attr = val: enum "TEXTURE" not found in ()

You can try it yourself in this blend file. The expected result is the cube is become blue because of texture order change.
Do anyone know how to get around this?
:confused: