langchain/libs/community/tests/integration_tests/utilities/test_clickup.py

89 lines
2.5 KiB
Python
Raw Normal View History

"""Integration test for JIRA API Wrapper."""
import json
from datetime import datetime
import pytest
community[major], core[patch], langchain[patch], experimental[patch]: Create langchain-community (#14463) Moved the following modules to new package langchain-community in a backwards compatible fashion: ``` mv langchain/langchain/adapters community/langchain_community mv langchain/langchain/callbacks community/langchain_community/callbacks mv langchain/langchain/chat_loaders community/langchain_community mv langchain/langchain/chat_models community/langchain_community mv langchain/langchain/document_loaders community/langchain_community mv langchain/langchain/docstore community/langchain_community mv langchain/langchain/document_transformers community/langchain_community mv langchain/langchain/embeddings community/langchain_community mv langchain/langchain/graphs community/langchain_community mv langchain/langchain/llms community/langchain_community mv langchain/langchain/memory/chat_message_histories community/langchain_community mv langchain/langchain/retrievers community/langchain_community mv langchain/langchain/storage community/langchain_community mv langchain/langchain/tools community/langchain_community mv langchain/langchain/utilities community/langchain_community mv langchain/langchain/vectorstores community/langchain_community mv langchain/langchain/agents/agent_toolkits community/langchain_community mv langchain/langchain/cache.py community/langchain_community mv langchain/langchain/adapters community/langchain_community mv langchain/langchain/callbacks community/langchain_community/callbacks mv langchain/langchain/chat_loaders community/langchain_community mv langchain/langchain/chat_models community/langchain_community mv langchain/langchain/document_loaders community/langchain_community mv langchain/langchain/docstore community/langchain_community mv langchain/langchain/document_transformers community/langchain_community mv langchain/langchain/embeddings community/langchain_community mv langchain/langchain/graphs community/langchain_community mv langchain/langchain/llms community/langchain_community mv langchain/langchain/memory/chat_message_histories community/langchain_community mv langchain/langchain/retrievers community/langchain_community mv langchain/langchain/storage community/langchain_community mv langchain/langchain/tools community/langchain_community mv langchain/langchain/utilities community/langchain_community mv langchain/langchain/vectorstores community/langchain_community mv langchain/langchain/agents/agent_toolkits community/langchain_community mv langchain/langchain/cache.py community/langchain_community ``` Moved the following to core ``` mv langchain/langchain/utils/json_schema.py core/langchain_core/utils mv langchain/langchain/utils/html.py core/langchain_core/utils mv langchain/langchain/utils/strings.py core/langchain_core/utils cat langchain/langchain/utils/env.py >> core/langchain_core/utils/env.py rm langchain/langchain/utils/env.py ``` See .scripts/community_split/script_integrations.sh for all changes
2023-12-11 21:53:30 +00:00
from langchain_community.utilities.clickup import ClickupAPIWrapper
@pytest.fixture
def clickup_wrapper() -> ClickupAPIWrapper:
return ClickupAPIWrapper()
def test_init(clickup_wrapper: ClickupAPIWrapper) -> None:
assert isinstance(clickup_wrapper, ClickupAPIWrapper)
def test_get_access_code_url() -> None:
assert isinstance(
ClickupAPIWrapper.get_access_code_url("oauth_client_id", "oauth_client_secret"),
str,
)
def test_get_access_token() -> None:
output = ClickupAPIWrapper.get_access_token(
"oauth_client_id", "oauth_client_secret", "code"
)
assert output is None
def test_folder_related(clickup_wrapper: ClickupAPIWrapper) -> None:
time_str = datetime.now().strftime("%d/%m/%Y-%H:%M:%S")
task_name = f"Test Folder - {time_str}"
# Create Folder
create_response = json.loads(
clickup_wrapper.run(mode="create_folder", query=json.dumps({"name": task_name}))
)
assert create_response["name"] == task_name
def test_list_related(clickup_wrapper: ClickupAPIWrapper) -> None:
time_str = datetime.now().strftime("%d/%m/%Y-%H:%M:%S")
task_name = f"Test List - {time_str}"
# Create List
create_response = json.loads(
clickup_wrapper.run(mode="create_list", query=json.dumps({"name": task_name}))
)
assert create_response["name"] == task_name
def test_task_related(clickup_wrapper: ClickupAPIWrapper) -> None:
time_str = datetime.now().strftime("%d/%m/%Y-%H:%M:%S")
task_name = f"Test Task - {time_str}"
# Create task
create_response = json.loads(
clickup_wrapper.run(
mode="create_task",
query=json.dumps({"name": task_name, "description": "This is a Test"}),
)
)
assert create_response["name"] == task_name
# Get task
task_id = create_response["id"]
get_response = json.loads(
clickup_wrapper.run(mode="get_task", query=json.dumps({"task_id": task_id}))
)
assert get_response["name"] == task_name
# Update task
new_name = f"{task_name} - New"
clickup_wrapper.run(
mode="update_task",
query=json.dumps(
{"task_id": task_id, "attribute_name": "name", "value": new_name}
),
)
get_response_2 = json.loads(
clickup_wrapper.run(mode="get_task", query=json.dumps({"task_id": task_id}))
)
assert get_response_2["name"] == new_name