# Tests

API URL - <https://api.moropo.com/tests>

### Available actions

1. Download Tests
2. Upload Tests

## Example - Download Tests

Note this request uses `GET` to inform the API that tests are being downloaded

```bash
curl -X 'GET' \
  'https://api.moropo.com/tests' \
  -H 'accept: application/zip' \
  -H 'x-app-api-key: MOROPO_API_KEY' \
  -H 'x-branch-name: main' --output tests.zip
```

Where;

* `MOROPO_API_KEY` is the API key for the target app, found in your [Moropo settings](https://app.moropo.com/settings?index=integrations).
* `BRANCH_NAME` is the name of the target branch to download tests from.

#### Expected Response

```json
blob:https://api.moropo.com/[UUID]
```

## Example - Upload Tests

Note this request uses `POST` to inform the API that tests are being upload

```bash
curl -X 'POST' \
  'https://api.moropo.com/tests' \
  -H 'accept: */*' \
  -H 'x-app-api-key: MOROPO_API_KEY' \
  -H 'x-merge-strategy: MERGE_STRATEGY' \
  -H 'x-branch-name: BRANCH_NAME' \
  -H 'Content-Type: multipart/form-data' \
  -F 'file=@FILE_NAME.zip;type=application/zip'
```

Where;

* `MOROPO_API_KEY` is the API key for the target app, found in your [Moropo settings](https://app.moropo.com/settings?index=integrations).
* `BRANCH_NAME` is the name of the target branch to download tests from.
* `MERGE_STRATEGY` is the strategy for merging. One of;
  * `overwrite` which will overwrite the existing test with a new copy if the names match
  * `changes_only` which will only upload tests which do not match existing tests
* `FILE_NAME` is the name of the test file being uploaded. Must be a `.zip`.

#### Expected Response

```json
1 - TEST_NAME:

   - Status: Success!
   - Path: TEST_NAME.yaml
   - Directory: DIR
   - Dependencies: DEPENDENCIES

```


---

# 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.moropo.com/ci-integration/moropo-api/tests.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.
