Skip to content

Commit

Permalink
Merge pull request #75 from akrherz/coverage
Browse files Browse the repository at this point in the history
Coverage
  • Loading branch information
akrherz authored Oct 2, 2023
2 parents 99dc9cc + cd4192b commit 3ac4b7d
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ repos:
hooks:
- id: black
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "v0.0.290"
rev: "v0.0.291"
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
Expand Down
9 changes: 7 additions & 2 deletions conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,16 @@

# third party
import pytest

# This repo
from iembot.basicbot import basicbot
from pyiem.database import get_dbconnc


@pytest.fixture()
def bot():
"""A basicbot."""
return basicbot("iembot", None, xml_log_path="/tmp")


@pytest.fixture()
def dbcursor(database):
"""Yield a cursor for the given database."""
Expand Down
24 changes: 24 additions & 0 deletions tests/test_util_channels.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
"""Test things done with channel subs."""

import pytest
from iembot.util import (
channels_room_add,
channels_room_del,
channels_room_list,
)


@pytest.mark.parametrize("database", ["mesosite"])
def test_room_list(bot, dbcursor):
"""Test listing of channel subscriptions for the room."""

def _local(room, msg):
"""Interception."""
assert room == "test"

channels_room_add(dbcursor, bot, "test", "XXX")

bot.send_groupchat = _local
channels_room_list(bot, "test")

channels_room_del(dbcursor, bot, "test", "XXX")

0 comments on commit 3ac4b7d

Please sign in to comment.