Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
- script: python -m flake8
displayName: 'Run linter'

- script: BOT_TOKEN=foobar python -m pytest --junitxml=junit.xml --cov=bot --cov-branch --cov-report=term --cov-report=xml tests
- script: BOT_API_KEY=foo BOT_TOKEN=bar WOLFRAM_API_KEY=baz python -m pytest --junitxml=junit.xml --cov=bot --cov-branch --cov-report=term --cov-report=xml tests
displayName: Run tests

- task: PublishCodeCoverageResults@1
Expand Down
7 changes: 1 addition & 6 deletions bot/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -347,9 +347,9 @@ class Channels(metaclass=YAMLGetter):
message_log: int
mod_alerts: int
modlog: int
off_topic_0: int
off_topic_1: int
off_topic_2: int
off_topic_3: int
python: int
reddit: int
talent_pool: int
Expand Down Expand Up @@ -394,8 +394,6 @@ class Guild(metaclass=YAMLGetter):
class Keys(metaclass=YAMLGetter):
section = "keys"

deploy_bot: str
deploy_site: str
site_api: str


Expand All @@ -411,14 +409,11 @@ class URLs(metaclass=YAMLGetter):

# Misc endpoints
bot_avatar: str
deploy: str
github_bot_repo: str
status: str

# Site endpoints
site: str
site_api: str
site_clean_api: str
site_superstarify_api: str
site_logs_api: str
site_logs_view: str
Expand Down
6 changes: 0 additions & 6 deletions config-default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -227,8 +227,6 @@ filter:


keys:
deploy_bot: !ENV "DEPLOY_BOT_KEY"
deploy_site: !ENV "DEPLOY_SITE"
site_api: !ENV "BOT_API_KEY"


Expand Down Expand Up @@ -263,10 +261,6 @@ urls:
# Snekbox
snekbox_eval_api: "https://snekbox.pythondiscord.com/eval"

# Env vars
deploy: !ENV "DEPLOY_URL"
status: !ENV "STATUS_URL"

# Discord API URLs
discord_api: &DISCORD_API "https://discordapp.com/api/v7/"
discord_invite_api: !JOIN [*DISCORD_API, "invites"]
Expand Down
23 changes: 23 additions & 0 deletions tests/test_constants.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import inspect

import pytest

from bot import constants


@pytest.mark.parametrize(
'section',
(
cls
for (name, cls) in inspect.getmembers(constants)
if hasattr(cls, 'section') and isinstance(cls, type)
)
)
def test_section_configuration_matches_typespec(section):
for (name, annotation) in section.__annotations__.items():
value = getattr(section, name)

if getattr(annotation, '_name', None) in ('Dict', 'List'):
pytest.skip("Cannot validate containers yet")

assert isinstance(value, annotation)