def test_validate_activity_when_no_warning(): activity = presences.Activity(name="test", type=presences.ActivityType.PLAYING) with mock.patch.object(warnings, "warn") as warn: bot_impl._validate_activity(activity) warn.assert_not_called()
def test_validate_activity_when_type_is_streaming_but_no_url(): activity = presences.Activity(name="test", url=None, type=presences.ActivityType.STREAMING) with mock.patch.object(warnings, "warn") as warn: bot_impl._validate_activity(activity) warn.assert_called_once_with( "The STREAMING activity type requires a 'url' parameter pointing to a valid Twitch or YouTube video " "URL to be specified on the activity for the presence update to have any effect.", category=errors.HikariWarning, stacklevel=3, )
def test_validate_activity_when_type_is_custom(): activity = presences.Activity(name="test", type=presences.ActivityType.CUSTOM) with mock.patch.object(warnings, "warn") as warn: bot_impl._validate_activity(activity) warn.assert_called_once_with( "The CUSTOM activity type is not supported by bots at the time of writing, and may therefore not have " "any effect if used.", category=errors.HikariWarning, stacklevel=3, )
def test_validate_activity_when_no_activity(activity): with mock.patch.object(warnings, "warn") as warn: bot_impl._validate_activity(activity) warn.assert_not_called()