-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #200 from 20001LastOrder/flag_options
Improve support for command line options - Use ArgumentParser to make parsing of command line options more robust - Add support for `gsite` option to scope search to a particular URL - Rename `real` tests to `external_api` to indicate tests that call 3rd party APIs (see #224 for more info) - Fix some broken tests There are 7 failing tests. This is a known issue and will be fixed separately, as the test breaks were introduced by other commits. Fixes #215
- Loading branch information
Showing
24 changed files
with
338 additions
and
128 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
from datetime import datetime | ||
|
||
import pytest | ||
from slackapp.bolt_app import get_response | ||
|
||
import sherpa_ai.config as cfg | ||
from sherpa_ai.verbose_loggers import DummyVerboseLogger | ||
|
||
|
||
@pytest.mark.external_api | ||
def test_get_response_contains_todays_date(): | ||
question = "What is the date today, using the following format: YYYY-MM-DD?" | ||
date = datetime.now().strftime("%Y-%m-%d") | ||
|
||
if cfg.SERPER_API_KEY is None: | ||
pytest.skip( | ||
"SERPER_API_KEY not found in environment variables, skipping this test" | ||
) | ||
|
||
verbose_logger = DummyVerboseLogger() | ||
|
||
response = get_response( | ||
question=question, | ||
previous_messages=[], | ||
user_id="", | ||
team_id="", | ||
verbose_logger=verbose_logger, | ||
bot_info={"user_id": "Sherpa"}, | ||
) | ||
assert date in response, "Today's date not found in response" | ||
|
||
|
||
@pytest.mark.external_api | ||
def test_response_contains_correct_info(): | ||
question = "What is AutoGPT and how does it compare with MetaGPT" | ||
|
||
if cfg.SERPER_API_KEY is None: | ||
pytest.skip( | ||
"SERPER_API_KEY not found in environment variables, skipping this test" | ||
) | ||
|
||
verbose_logger = DummyVerboseLogger() | ||
|
||
response = get_response( | ||
question=question, | ||
previous_messages=[], | ||
user_id="", | ||
team_id="", | ||
verbose_logger=verbose_logger, | ||
bot_info={"user_id": "Sherpa"}, | ||
) | ||
|
||
print(response) | ||
assert response is not None | ||
assert response != "" | ||
assert "AutoGPT" in response | ||
assert "MetaGPT" in response |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.