Example #1
0
def test_startswith_handler_check_negative_match_with_case_sensitive():
    message = type('Message', (), {'text': 'pong'})
    handler = handlers.StartswithHandler(pattern='hello',
                                         case_sensitive=False)
    assert not handler.check(message)
Example #2
0
def test_startswith_handler_check_negative_match():
    message = type('Message', (), {'text': 'Ping'})
    handler = handlers.StartswithHandler(pattern='hello my friend')
    assert not handler.check(message)
Example #3
0
def test_startswith_handler_check_with_case_sensitive():
    message = type('Message', (), {'text': 'Hello my friend'})
    handler = handlers.StartswithHandler(pattern='hello',
                                         case_sensitive=False)
    assert handler.check(message)
Example #4
0
def test_startswith_handler_check():
    message = type('Message', (), {'text': 'hello my friend'})
    handler = handlers.StartswithHandler(pattern='hello')
    assert handler.check(message)
Example #5
0
def test_startswith_handler_check_negative_match_with_case_sensitive(message):
    message.text = 'pong'
    handler = handlers.StartswithHandler(pattern='hello', case_sensitive=False)
    assert not handler.check(message)
Example #6
0
def test_startswith_handler_check_with_case_sensitive(message):
    message.text = 'hello my friend'
    handler = handlers.StartswithHandler(pattern='hello', case_sensitive=False)
    assert handler.check(message)
Example #7
0
def test_startswith_handler_check_negative_match(message):
    message.text = 'Ping'
    handler = handlers.StartswithHandler(pattern='hello my friend')
    assert not handler.check(message)
Example #8
0
def test_startswith_handler_check(message):
    message.text = 'hello my friend'
    handler = handlers.StartswithHandler(pattern='hello')
    assert handler.check(message)