🔘Pynt for pytest
Integrate Pynt with pytest to enhance API security testing. Automate security scans within your pytest test suites to detect and mitigate vulnerabilities effectively.
What is Pytest?
💡 pytest is a powerful testing framework for Python applications, designed for simple unit tests as well as complex functional testing. It supports fixtures, parameterized testing, and assertions, making it highly adaptable for a variety of testing needs. With its easy-to-read syntax and extensive plugin ecosystem, pytest helps streamline the testing process for Python developers, ensuring robust and maintainable test suites.
Pynt's integration with pytest
As part of its API security testing suit, Pynt allows seamless integration with any Pytest API testing.
By integrating Pynt with pytest, you can leverage the power of this vast platform while enhancing your API security. Pynt automatically generates context-aware security tests based on your pytest test scripts, enabling you to identify vulnerabilities early in the development cycle and reduce the risk of security issues in production.
Quick start
First, make sure Pynt's prerequisites are met.
Follow the instructions to install Pynt container here.
Then, continue with the below example.
Example
goat_functional_test.py is a python based tester for goat (our vulnerable application) that we use to test the functionality of goat, we run it with:
Now, to run Pynt on it, we run:
SSL Support
Automatic Self-signed certificates
Pynt can automatically set your pytest to use self signed certificate. use the flag --self-signed
If your functional test is enforcing SSL certificate verification (e.g. https) you will need to provide Pynt a certificate, If your client need a specific certificate, provide the path to it with --ca_path
Manually providing certificates
If your client does not use a specific certificate you will need to generate a certificate file and provide it to Pynt:
Generate a certificate (Linux)
1) Download make_certificate.sh
2) Download openssl.cnf
3) chmod +x make_certificate.sh
4) Generate the certificate: ./make_certificate.sh
Run Pynt with the generated certificate
Use the export REQUESTS_CA_BUNDLE before your command to instruct your functional test to use the new certificate and provide the path ti the certificate with --ca-path to instruct Pynt to use the generated certificate.
💡 Pynt CLI Troubleshooting: If you're encountering issues with Pynt's CLI, visit the Pynt CLI Troubleshooting Guide for solutions and troubleshooting tips.
💡 Still Need Help? For any questions or troubleshooting, reach out to the Pynt Community Support.
Last updated