Exemple #1
0
def test_bot_reply_specific_time(driver):
    t_time = datetime.now() + timedelta(seconds=2)
    str_t_time = t_time.strftime('%b-%d-%Y_%H:%M:%S')
    driver.send_direct_message('reply "{0}" at {0}'.format(str_t_time),
                               tobot=True)
    driver.wait_for_bot_direct_message(str_t_time,
                                       maxwait=settings.JOB_TRIGGER_PERIOD + 5)
Exemple #2
0
def test_bot_reply_to_message_multiple_decorators(driver):  # noqa: F811
    driver.send_channel_message('hello_decorators')
    driver.wait_for_bot_channel_message('hello!', tosender=False)
    driver.send_channel_message('hello_decorators', tobot=False)
    driver.wait_for_bot_channel_message('hello!', tosender=False)
    driver.send_direct_message('hello_decorators')
    driver.wait_for_bot_direct_message('hello!')
def test_allowed_channels(driver):  # noqa: F811

    driver.send_direct_message('allowed_channel', tobot=True)
    driver.wait_for_bot_direct_message('Driver in channel allowed!')

    driver.send_private_channel_message('allowed_channel', tobot=True)
    driver.wait_for_bot_private_channel_message('Driver in channel allowed!',
                                                tosender=True)

    driver.send_private_channel_message('not_allowed_channel', tobot=True)
    try:
        driver.wait_for_bot_private_channel_message(
            'Driver in channel NOT allowed!', tosender=True)
        raise AssertionError(
            'response "Driver in channel NOT allowed" was not expected.')
    except AssertionError:
        pass
Exemple #4
0
def test_bot_reply_every_seconds(driver):
    driver.send_direct_message('reply "alive" every 6 seconds', tobot=True)
    driver.wait_for_bot_direct_message('alive',
                                       maxwait=settings.JOB_TRIGGER_PERIOD + 5)
    driver.wait_for_bot_direct_message('alive',
                                       maxwait=settings.JOB_TRIGGER_PERIOD + 5)
    driver.send_direct_message('cancel jobs', tobot=True)
    driver.wait_for_bot_direct_message('all jobs canceled.',
                                       maxwait=settings.JOB_TRIGGER_PERIOD + 5)
Exemple #5
0
def test_bot_respond_to_simple_message_with_formatting(driver):  # noqa: F811
    driver.send_direct_message('hello_formatting')
    driver.wait_for_bot_direct_message('_hello_ sender!')
Exemple #6
0
def test_bot_respond_to_simple_message(driver):  # noqa: F811
    driver.send_direct_message('hello')
    driver.wait_for_bot_direct_message('hello sender!')
Exemple #7
0
def test_bot_direct_message_with_at_prefix(driver):  # noqa: F811
    driver.send_direct_message('hello', tobot=True)
    driver.wait_for_bot_direct_message('hello sender!')
    driver.send_direct_message('hello', tobot=True, colon=False)
    driver.wait_for_bot_direct_message('hello sender!')
Exemple #8
0
def test_bot_respond_to_simple_message_case_insensitive(driver):  # noqa: F811
    driver.send_direct_message('hEllO')
    driver.wait_for_bot_direct_message('hello sender!')