mirror of
https://github.com/aljazceru/Auto-GPT.git
synced 2025-12-17 14:04:27 +01:00
adding openai plugin loader
This commit is contained in:
@@ -1,10 +1,8 @@
|
||||
import pytest
|
||||
from pathlib import Path
|
||||
from zipfile import ZipFile
|
||||
from autogpt.plugins import inspect_zip_for_module, scan_plugins, load_plugins
|
||||
from autogpt.config import Config
|
||||
|
||||
PLUGINS_TEST_DIR = "tests/unit/data/test_plugins/"
|
||||
PLUGINS_TEST_DIR = "tests/unit/data/test_plugins"
|
||||
PLUGIN_TEST_ZIP_FILE = "Auto-GPT-Plugin-Test-master.zip"
|
||||
PLUGIN_TEST_INIT_PY = "Auto-GPT-Plugin-Test-master/src/auto_gpt_plugin_template/__init__.py"
|
||||
|
||||
@@ -13,15 +11,16 @@ PLUGIN_TEST_INIT_PY = "Auto-GPT-Plugin-Test-master/src/auto_gpt_plugin_template/
|
||||
def config_with_plugins():
|
||||
cfg = Config()
|
||||
cfg.plugins_dir = PLUGINS_TEST_DIR
|
||||
cfg.plugins_openai = ['https://weathergpt.vercel.app/']
|
||||
return cfg
|
||||
|
||||
|
||||
def test_inspect_zip_for_module():
|
||||
result = inspect_zip_for_module(str(PLUGINS_TEST_DIR + PLUGIN_TEST_ZIP_FILE))
|
||||
result = inspect_zip_for_module(str(f'{PLUGINS_TEST_DIR}/{PLUGIN_TEST_ZIP_FILE}'))
|
||||
assert result == PLUGIN_TEST_INIT_PY
|
||||
|
||||
def test_scan_plugins():
|
||||
result = scan_plugins(PLUGINS_TEST_DIR, debug=True)
|
||||
def test_scan_plugins(config_with_plugins):
|
||||
result = scan_plugins(config_with_plugins, debug=True)
|
||||
assert len(result) == 1
|
||||
assert result[0][0] == PLUGIN_TEST_INIT_PY
|
||||
|
||||
|
||||
Reference in New Issue
Block a user