> For the complete documentation index, see [llms.txt](https://doc.bunq.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://doc.bunq.com/getting-started/tools/unmaintained-software-development-kits-sdks/python/tests.md).

# Tests

Currently we are not targeting the 100% test coverage, but rather want to be certain that the most common scenarios can run without any errors.

### Scenarios

These are the scenarios that are currently being tested:

* Create installation, session-server and device server
* Create a new MonetaryAccount
* Create a tab
* Update the tab
* Create attachment and avatar
* Request money from first MA to second MA
* Accept the request
* Make a transaction from first MA to second MA
* Create connect gr code
* Make a payment to another sandbox user
* Send a chat message in a recent payment
* Delete the current session
* Order a card with a second line

Besides these scenarios, some code of ApiContext, ApiClient and the JSON module are also tested :thumbs\_up:.

### Configuration

To run the tests you must first setup the test configuration JSON. The example of a configuration file is located at [`tests/assets/config.example.json`](https://github.com/bunq/sdk_python/blob/develop/tests/assets/config.example.json). In order to make use of the configuration file, please copy the example to the same directory, fill in your sandbox user data and rename the copy to config.json.

Note:

* `MONETARY_ACCOUNT_ID` and `MONETARY_ACCOUNT_ID2` must be of same user
* `CounterPartyOther` must be of another Sandbox user
* You can create a `CASH_REGISTER_ID` on doc.bunq.com
  1. Add your **Developer Key** to `settings`
  2. Upload an image to the `Attachment Public` endpoint
  3. Create an `Avatar` with the returned UUID
  4. Use the Avatar's UUID to create a `Cash Register`
  5. Copy the Cash Register's ID to the `config.json`

### Installation and Execution

To run the tests, you must first generate a certificate and key. To do this run the following command, but first update "Your App Id" to a unique id.

```csharp
openssl req -x509 -newkey rsa:4096 -keyout tests/key.pem -out tests/certificate.pem -days 365 -nodes -subj "/CN=Your App Id/C=NL" && \
echo -e "\n--- KEY ---\n" && cat tests/key.pem && \
echo -e "\n--- CERTIFICATE ---\n" && cat tests/certificate.pem
```

You can install all the required dependencies with the following command:

```powershell
python setup.py install
```

You can run all the tests via command line:

```python
python -m unittest discover -s tests/context && \
python -m unittest discover -s tests/http && \
python -m unittest discover -s tests/model/generated
```

or via PyCharm, but first you must configure PyCharm by doing the following:

* Go to `Preferences` --> `Tools` --> `Python integrated tools` and change default test runner to `unittests`.
* Configure your Python interpreter to an supported Python version. Python 3 is recommended.

Afterwards you can right click on the tests folders and should be able to run the tests cases form the IDE.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://doc.bunq.com/getting-started/tools/unmaintained-software-development-kits-sdks/python/tests.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
