Пример #1
0
    def test_start_settings_mp3_bad(self, mock_send_msg, mock_get_option_args,
                                    mock_admin):
        client = Mock()
        poll = Mock()
        request_form = Mock()

        mock_get_option_args.return_value = ('mp3', '')

        start_settings(client, poll, request_form)
        assert mock_send_msg.called
Пример #2
0
    def test_start_settings_mp3_off(self, mock_send_msg, mock_get_option_args,
                                    mock_admin):
        client = Mock()
        poll = Mock()
        request_form = Mock()

        mock_get_option_args.return_value = ('mp3', 'off')

        start_settings(client, poll, request_form)
        self.assertFalse(poll.is_music_upload)
        assert mock_send_msg.called
Пример #3
0
def test_start_settings_mp3_bad(mocker):
    mocked_admin = mocker.patch('handlers.decorators.is_admin')
    mocked_get_options = mocker.patch(
        'handlers.commands.settings.get_settings_option_and_option_argument')
    mocked_send_to_usr = mocker.patch(
        'handlers.commands.settings.send_msg_to_user')

    mocked_get_options.return_value = ('mp3', '')

    start_settings(Mock(), Mock(), Mock())
    assert mocked_send_to_usr.called
Пример #4
0
def test_start_settings_mp3_off(mocker):
    mocked_admin = mocker.patch('handlers.decorators.is_admin')
    mocked_get_options = mocker.patch(
        'handlers.commands.settings.get_settings_option_and_option_argument')
    mocked_send_to_usr = mocker.patch(
        'handlers.commands.settings.send_msg_to_user')

    mocked_get_options.return_value = ('mp3', 'off')
    poll = Mock()

    start_settings(Mock(), poll, Mock())
    assert not poll.is_music_upload
    assert mocked_send_to_usr.called
Пример #5
0
def handle_commands(client: WebClient, poll: Poll, request_form: dict) -> None:
    """
    Function, that will handle all the commands that is going to be sent to the bot.
    """
    command = request_form.get('command')

    if command == '/disco':
        start_disco(client, poll, request_form)
    elif command == '/lightsoff':
        start_lightsoff(client, poll, request_form)
    elif command == '/poptop':
        start_poptop(client, poll, request_form)
    elif command == '/top':
        start_top(client, poll, request_form)
    elif command == '/poll_status':
        start_poll_status(client, poll, request_form)
    elif command == '/settings':
        start_settings(client, poll, request_form)
    elif command == '/drop':
        start_drop(client, poll, request_form)
    elif command == '/resume':
        start_resume(client, poll, request_form)