> For the complete documentation index, see [llms.txt](https://docs.docbits.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.docbits.com/chinese/guan-li-yu-she-zhi/settings/document-processing/import/test-ftp-import-connection.md).

# 测试：FTP 导入连接

#### 目的

这些测试用于确保 FTP 导入系统能够正常工作。我们会验证是否可以添加新的 FTP 导入连接、测试连接、启用或停用连接，并在之后清理连接。

{% embed url="<https://grafana.polydocs.io/d-solo/b6ad3a9c-260c-46a3-9ade-47691e743d4d/docbits?from=1715746603760&orgId=1&panelId=84&refresh=1m&to=1715768203760>" %}

## 测试场景

1. **设置：**
   * **环境变量：** 从环境变量加载所需信息，例如 FTP 服务器信息和凭据。
2. **FTP 连接测试：**

   **添加新连接：**

   * **测试添加新的 FTP 导入连接 (`test_add_new_ftp_import_connection`)：**
     * 使用给定的凭据和服务器信息添加新的 FTP 导入连接。
     * **预期结果：** 连接应成功添加。

   **停用连接：**

   * **测试停用 FTP 导入连接 (`test_deactivate_ftp_import_connection`)：**
     * 停用刚添加的 FTP 导入连接。
     * **预期结果：** 连接应成功停用。

   **测试连接：**

   * **测试 FTP 连接 (`test_test_ftp_connection`)：**
     * 测试 FTP 导入连接是否能够成功连接到 FTP 服务器。
     * **预期结果：** 连接应成功通过测试。

   **检查连接列表：**

   * **测试检查列表中的 FTP 连接 (`test_check_ftp_connection_in_list`)：**
     * 检查新添加的 FTP 导入连接是否出现在连接列表中。
     * **预期结果：** 应在列表中找到该连接。

   **检查连接是否已停用：**

   * **测试检查 FTP 连接是否已停用 (`test_check_ftp_connection_deactivated`)：**
     * 验证连接列表中的 FTP 导入连接是否标记为未启用。
     * **预期结果：** 连接应处于未启用状态。

   **添加测试文件夹：**

   * **测试向连接添加测试文件夹 (`test_add_test_folder_to_connection`)：**
     * 向 FTP 导入连接添加默认目录（测试文件夹）。
     * **预期结果：** 默认目录应成功添加。

   **重新启用连接：**

   * **测试重新启用 FTP 导入连接 (`test_reactivate_ftp_import_connection`)：**
     * 重新启用此前停用的 FTP 导入连接。
     * **预期结果：** 连接应成功重新启用。

   **检查连接是否已重新启用：**

   * **测试检查 FTP 连接是否已重新启用 (`test_check_ftp_connection_reactivated`)：**
     * 验证连接列表中的 FTP 导入连接是否标记为已启用。
     * **预期结果：** 连接应处于已启用状态。

   **清理：**

   * **测试清理 FTP 导入连接 (`test_cleanup_ftp_import`)：**
     * 删除 FTP 导入连接，以便在测试后进行清理。
     * **预期结果：** 连接应成功删除。

## 各项测试的详细说明

* **设置和初始化：**
  * **初始化共享数据：** 为测试准备共享数据。
* **FTP 连接测试：**
  * **添加新连接：** 使用提供的凭据和服务器信息添加新的 FTP 导入连接。
  * **停用连接：** 停用刚添加的 FTP 导入连接。
  * **测试连接：** 测试 FTP 导入连接是否能够成功连接到 FTP 服务器。
  * **检查连接列表：** 验证新添加的 FTP 导入连接是否出现在连接列表中。
  * **检查连接是否已停用：** 确认连接列表中的 FTP 导入连接是否标记为未启用。
  * **添加测试文件夹：** 向 FTP 导入连接添加默认目录（测试文件夹）。
  * **重新启用连接：** 重新启用此前停用的 FTP 导入连接。
  * **检查连接是否已重新启用：** 确认连接列表中的 FTP 导入连接是否标记为已启用。
  * **清理：** 删除 FTP 导入连接，以便在测试后进行清理。

\\


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.docbits.com/chinese/guan-li-yu-she-zhi/settings/document-processing/import/test-ftp-import-connection.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
