'Test whether an error is returned when we try to cancel an order that has expired'

@deferred(timeout=10)
def test_cancel_order(self):

    order = self.session.lm.market_community.order_manager.create_ask_order(Price(3, 'DUM1'), Quantity(4, 'DUM2'), Timeout(3600))
    def on_response(response):
        json_response = json.loads(response)
        self.assertTrue(json_response['cancelled'])
        cancelled_order = self.session.lm.market_community.order_manager.order_repository.find_by_id(order.order_id)
        self.assertTrue(cancelled_order.cancelled)
    self.should_check_equality = False
    return self.do_request('market/orders/1/cancel', request_type='POST', expected_code=200).addCallback(on_response)
