'Tests update server changing the flavor.
Server.handle_update supports changing the flavor, and makes
the change making a resize API call against Nova.'

def test_server_update_server_flavor(self):

    return_server = self.fc.servers.list()[1]
    return_server.id = '1234'
    server = self._create_test_server(return_server, 'srv_update')
    update_props = self.server_props.copy()
    update_props['flavor'] = 'm1.small'
    update_template = server.t.freeze(properties=update_props)
    def set_status(status):
        return_server.status = status
        return return_server
    self.patchobject(self.fc.servers, 'get', side_effect=[set_status('ACTIVE'), set_status('RESIZE'), set_status('VERIFY_RESIZE'), set_status('VERIFY_RESIZE'), set_status('ACTIVE')])
    mock_post = self.patchobject(self.fc.client, 'post_servers_1234_action', return_value=(202, None))
    scheduler.TaskRunner(server.update, update_template)()
    self.assertEqual((server.UPDATE, server.COMPLETE), server.state)
    mock_post.called_once_with(body={'resize': {'flavorRef': 2}})
    mock_post.called_once_with(body={'confirmResize': None})
