John Williams
06/22/2022, 12:42 PMself = '<http://localhost:1234>'
def cancel(self):
> if self.status == 'progress':
E AttributeError: 'str' object has no attribute 'status'
../orders_service/orders.py:48: AttributeError
Mike Geeves
06/22/2022, 1:55 PMself.__status
in init rather than self.status
that's being used here - you'll need the attributes to match, so should be self.__status
here as wellJohn Williams
06/22/2022, 11:25 PMwith pact:
response = consumer.cancel()
or something?John Williams
06/23/2022, 3:02 AMJohn Williams
06/23/2022, 3:02 AMERROR consumer.py::test_cancel_scheduled_order - requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=3001): Max retries exceeded w...
John Williams
06/23/2022, 3:08 AMJohn Williams
06/23/2022, 3:18 AMpact = <pact.pact.Pact object at 0x103b5d3d0>, consumer = None
def test_cancel_scheduled_order(pact, consumer):
expected = \
{
"id": "1e54e244-d0ab-46ed-a88a-b9e6037655ef",
"order": [
{
"product": "coffee",
"quantity": 1,
"size": "small"
}
],
"scheduled": "Wed, 22 Jun 2022 09:21:26 GMT",
"status": "cancelled"
}
(pact
.given('A scheduled order exists and it is not cancelled already')
.upon_receiving('a request for cancellation')
.with_request('get', f'<http://localhost:3001/kitchen/schedule/{Like(12343)}/cancel>')
.will_respond_with(200, body=Like(expected)))
with pact:
order = [{"id":1, "product":"coffee", "size":"small", "quantity":1}]
payload = Order(id="76ac3eb5-a656-49e3-b973-17e7c992cc5e", created="2022-06-23T03:11:19.415574", items=order, status="created")
# return Order.cancel(payload)
# payload = Order(UUID, datetime.now, {"product":"coffee", "size":"large", "quantity":1}, "progress")
print(payload)
> response = consumer.cancel(payload)
E AttributeError: 'NoneType' object has no attribute 'cancel'
consumer.py:110: AttributeError
hmmm im not sure what im doijng wrong can someone help?Mike Geeves
06/23/2022, 6:29 AMconsumer = None
that's why it doesn't have an attribute cancel, or any attributesMike Geeves
06/23/2022, 6:30 AMMike Geeves
06/23/2022, 6:32 AMJohn Williams
06/23/2022, 8:46 AMJohn Williams
06/23/2022, 8:47 AMJohn Williams
06/23/2022, 8:55 AM