-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test OAuth requests using pact.io as mock server OP#40804 #22
Conversation
01e669f
to
7cf6be3
Compare
Hi everybody, I am not familiar with the PHP toolchain etc. So I cannot be of great help here. At OP we use similar stuff, for instance Puffing Billy, which allows for mocking services on the browser level. It definitely has its legitimacy. Needless to say, that it will not save us from:
|
$consumerRequest = new ConsumerRequest(); | ||
$consumerRequest | ||
->setMethod('GET') | ||
->setPath('/api/v3/work_packages') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
using a variable for this path will be useful since it is used multiple times below.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done, moved the path and also the URL of the mock-server into a variable, please review again
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm fine with any choice you make for testing.
Signed-off-by: Artur Neumann <artur@jankaritech.com>
7cf6be3
to
c802bb3
Compare
c802bb3
to
096dda1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good 👍
using the framework of pact.io to mock the OAuth requests of OpenProject and testing the
request
functionI'm open for discussion if that is the framework we want to use to mock the requests. The advantage is that, we can simulate real requests and responses without having to spin up a complete NC or OpenProject server.
The framework writes the requests and response into a JSON file and in future we can use that to verify that what we expect from OpenProject is really what they send.
here a short intro in how it works: https://docs.pact.io/getting_started/how_pact_works#consumer-testing