Requirements:
* install this module
* create a Flask app
* CONTRACT_TEST
environment variable must be defined
* from spring.cloud.contract
import Stub
from flask import Flask
from spring.cloud.contract import Stub
app = Flask(__name__)
def send_message(val1, val2):
'''send a message'''
stub = Stub(app)
stub.create_stub(send_message, 'someValue', 'testing')
app.run()
See sample.py
To run the sample:
export CONTRACT_TEST=true
cd sample
python sample.py
To invoke the test endpoints.
curl -XPOST http://localhost:5000/springcloudcontract/message
curl -XPOST http://localhost:5000/springcloudcontract/bad
curl -XPOST http://localhost:5000/springcloudcontract/function1