Skip to content
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

Merged
merged 2 commits into from
Jan 27, 2022

Conversation

individual-it
Copy link
Collaborator

using the framework of pact.io to mock the OAuth requests of OpenProject and testing the request function

I'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

@wielinde
Copy link
Collaborator

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:

  • Manual tests
  • Real integration tests
    which we need to tackle and setup one by one, too.

$consumerRequest = new ConsumerRequest();
$consumerRequest
->setMethod('GET')
->setPath('/api/v3/work_packages')
Copy link
Contributor

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.

Copy link
Collaborator Author

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

Copy link
Member

@julien-nc julien-nc left a 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>
Signed-off-by: Artur Neumann <artur@jankaritech.com>
Copy link
Contributor

@kiranparajuli589 kiranparajuli589 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good 👍

@individual-it individual-it merged commit 9de73dc into master Jan 27, 2022
@delete-merged-branch delete-merged-branch bot deleted the pactTests branch January 27, 2022 04:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants