mirror of
https://github.com/aljazceru/Auto-GPT.git
synced 2026-01-07 16:24:19 +01:00
* Fix updated cassettes step * Clarifications * Use github.ref_name instead of github.ref * Fix duplicate runs on `master` --------- Co-authored-by: Reinier van der Leer <github@pwuts.nl>
31 lines
904 B
Python
31 lines
904 B
Python
import pytest
|
|
from pytest_mock import MockerFixture
|
|
|
|
from autogpt.agent import Agent
|
|
from autogpt.commands.file_operations import read_file
|
|
from autogpt.config import Config
|
|
from tests.integration.challenges.challenge_decorator.challenge_decorator import (
|
|
challenge,
|
|
)
|
|
from tests.integration.challenges.utils import run_interaction_loop
|
|
from tests.utils import requires_api_key
|
|
|
|
CYCLE_COUNT = 3
|
|
|
|
|
|
@requires_api_key("OPENAI_API_KEY")
|
|
@pytest.mark.vcr
|
|
@challenge
|
|
def test_write_file(
|
|
writer_agent: Agent,
|
|
patched_api_requestor: MockerFixture,
|
|
monkeypatch: pytest.MonkeyPatch,
|
|
config: Config,
|
|
level_to_run: int,
|
|
) -> None:
|
|
file_path = str(writer_agent.workspace.get_path("hello_world.txt"))
|
|
run_interaction_loop(monkeypatch, writer_agent, CYCLE_COUNT)
|
|
|
|
content = read_file(file_path, config)
|
|
assert content == "Hello World", f"Expected 'Hello World', got {content}"
|