Skip to content

Commit

Permalink
Fix CLI test to work in GitHub workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
grahamtt committed Nov 27, 2023
1 parent 58079ed commit 7a89c59
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 3 deletions.
2 changes: 1 addition & 1 deletion prosper_bot/cli/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def _schema():
}


def build_config():
def build_config() -> Config:
"""Compiles all the config sources into a single config."""
return Config.autoconfig(
["prosper-api", "prosper-bot"], _arg_parser(), validate=True
Expand Down
25 changes: 23 additions & 2 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,31 @@
import sys
from decimal import Decimal

from prosper_bot.cli import build_config


class TestCli:
def test_build_config(self, mocker):
mocker.patch.object(sys, "argv", [])
mocker.patch.object(
sys,
"argv",
[
"test-cli",
"--client-id=0123456789abcdef0123456789abcdef",
"--username=fake-username",
"--token-cache=fake-token-cache",
],
)

build_config()
config = build_config()

assert config._config_dict["bot"] == {
"dry-run": False,
"min-bid": Decimal("25"),
"verbose": False,
}
assert config._config_dict["credentials"] == {
"client-id": "f3c747293f3e4dc5a27a6ff3cf4f6805",
"username": "fake-username",
}
assert config._config_dict["auth"]["token-cache"] is not None

0 comments on commit 7a89c59

Please sign in to comment.