Writing unit tests with a service account #622
-
Hello, i am trying to write some unit tests using pnp core. I just want to use a service account to do some read/write actions to a share point site. Are there any examples especially on how to handle the authentication? Thanks in advance! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
@TastyToasty : maybe our test projects can serve as inspiration for your unit tests as well, see https://github.com/pnp/pnpcore/tree/dev/src/sdk/PnP.Core.Test and https://github.com/pnp/pnpcore/tree/dev/src/sdk/PnP.Core.Admin.Test as examples. Our test project setup is slightly more complicated as we have an offline test concept, meaning you can run a test and record the server responses. You can then reply these responses to run your test fully offline. We've built this concept to allow for fast test execution while developing. See https://pnp.github.io/pnpcore/contributing/writing%20tests.html to learn more about how to use our testing system. In general you would want to create a PnPContext in your test project and doing that is described here: https://pnp.github.io/pnpcore/using-the-sdk/readme.html. In your settings file you can chose to use the |
Beta Was this translation helpful? Give feedback.
@TastyToasty : maybe our test projects can serve as inspiration for your unit tests as well, see https://github.com/pnp/pnpcore/tree/dev/src/sdk/PnP.Core.Test and https://github.com/pnp/pnpcore/tree/dev/src/sdk/PnP.Core.Admin.Test as examples. Our test project setup is slightly more complicated as we have an offline test concept, meaning you can run a test and record the server responses. You can then reply these responses to run your test fully offline. We've built this concept to allow for fast test execution while developing. See https://pnp.github.io/pnpcore/contributing/writing%20tests.html to learn more about how to use our testing system.
In general you would want to create a PnPCo…