# Pynt for pytest

## **What is Pytest?**

{% hint style="info" %}
💡 [**pytest**](https://pytest.org/) 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.
{% endhint %}

<figure><img src="/files/VYMBewyo8l18mNWUbLAb" alt="" width="188"><figcaption><p>PyTest</p></figcaption></figure>

***

## **Pynt's integration with pytest**

As part of its [API security testing](/documentation/api-security-testing/security-testing-overview.md) suit, Pynt allows seamless [integration](broken://pages/ehealt8LVTt8DWD89CXX) 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

1. First, make sure Pynt's [prerequisites](/documentation/api-security-testing/prerequisites-for-running-pynt-scans.md) are met.
2. Follow the instructions to install Pynt container [here](/documentation/api-security-testing/how-to-install-pynt-cli.md).
3. Then, continue with the below example.

***

## Example

[goat\_functional\_test.py](https://raw.githubusercontent.com/pynt-io/pynt/main/goat_functional_tests/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:&#x20;

```sh
pytest goat_functional_test.py
```

Now, to run Pynt on it, we run:

```bash
pynt command --cmd "pytest goat_functional_test.py"
```

***

## SSL Support

### Automatic Self-signed certificates

Pynt can automatically set your pytest to use self signed certificate. use the flag `--self-signed`

```bash
pynt command --cmd "<your test command>" --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

```sh
pynt command --cmd "<your test command>" --ca-path <path to certificate file>
```

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](https://raw.githubusercontent.com/pynt-io/pynt/main/command/make_certificate.sh)

2\) Download [openssl.cnf](https://raw.githubusercontent.com/pynt-io/pynt/main/command/openssl.cnf)

3\) `chmod +x make_certificate.sh`

4\) Generate the certificate: `./make_certificate.sh`&#x20;

***

### 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.

{% code overflow="wrap" %}

```sh
pynt command --cmd "export REQUESTS_CA_BUNDLE=rootCA.crt && python3 <your command here>" --ca-path rootCA.pem
```

{% endcode %}

***

{% hint style="info" %}
💡 **Pynt CLI Troubleshooting**: If you're encountering issues with Pynt's CLI, visit the [**Pynt CLI Troubleshooting Guide**](https://docs.pynt.io/documentation/api-security-testing/pynt-scans-troubleshooting/pynt-cli-troubleshooting) for solutions and troubleshooting tips.
{% endhint %}

{% hint style="info" %}
💡 **Still Need Help?** For any questions or troubleshooting, reach out to the [**Pynt Community Support**](https://www.pynt.io/community).
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.pynt.io/documentation/security-testing-integrations/pynt-with-testing-frameworks/pynt-for-pytest.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
