def test_it_returns_none_when_finding_missing_bot( install_store: TeamiclinkInstallStore, mocker ): # given read = mocker.patch.object(install_store, "read_bot") read.side_effect = MissingBotError("any_message") # when result = install_store.find_installation(team_id=TEAM_ID) # then assert result is None
def test_it_finds_installation(install_store: TeamiclinkInstallStore, mocker): # given read = mocker.patch.object(install_store, "read_bot") bot = TeamiclinkBot( id=uuid4(), team_id=TEAM_ID, bot_token=BOT_TOKEN, bot_id=BOT_ID, bot_user_id=BOT_USER_ID, installed_at=INSTALLED_AT, ) read.return_value = bot # when result = install_store.find_installation(team_id=bot.team_id) # then read.assert_called_once_with(team_id=TEAM_ID) assert result.user_id == "" assert result.team_id == bot.team_id assert result.bot_id == bot.bot_id assert result.bot_user_id == bot.bot_user_id assert result.bot_token == bot.bot_token assert result.installed_at == bot.installed_at.timestamp()