from bottery import patterns


def test_message_handler_check_positive_match():
    message = type('Message', (), {'text': 'ping'})
    handler = patterns.MessageHandler(pattern='ping')
    assert handler.check(message)


def test_message_handler_check_negative_match():
    message = type('Message', (), {'text': 'pong'})
    handler = patterns.MessageHandler(pattern='ping')
    assert not handler.check(message)


def test_message_handler_check_positive_match_with_case_sensitive():
    message = type('Message', (), {'text': 'Ping'})
    handler = patterns.MessageHandler(pattern='Ping',
                                      case_sensitive=True)
    assert handler.check(message)


def test_message_handler_check_negative_match_with_case_sensitive():
    message = type('Message', (), {'text': 'Ping'})
    handler = patterns.MessageHandler(pattern='ping',
                                      case_sensitive=True)
    assert not handler.check(message)


def test_startswith_handler_check_positive_match():
    message = type('Message', (), {'text': 'hello my friend'})
    handler = patterns.StartswithHandler(pattern='hello')
    assert handler.check(message)


def test_startswith_handler_check_negative_match():
    message = type('Message', (), {'text': 'Ping'})
    handler = patterns.StartswithHandler(pattern='hello my friend')
    assert not handler.check(message)


def test_startswith_handler_check_positive_match_with_sensitive():
    message = type('Message', (), {'text': 'Hello my friend'})
    handler = patterns.StartswithHandler(pattern='hello',
                                         case_sensitive=False)
    assert handler.check(message)


def test_startswith_handler_check_negative_match_with_sensitive():
    message = type('Message', (), {'text': 'pong'})
    handler = patterns.StartswithHandler(pattern='hello',
                                         case_sensitive=False)
    assert not handler.check(message)


def test_default_handler():
    message = type('Message', (), {'text': 'pong'})
    assert patterns.DefaultHandler().check(message)


def test_patterns_handlers():
    handler = patterns.PatternsHandler()
    assert not handler.registered


def test_patterns_handler_message():
    handler = patterns.PatternsHandler()
    decorator = handler.message('ping')

    def view(): 'pong'
    assert callable(decorator)
    assert decorator(view) == view
    assert handler.registered


def test_patterns_handler_startswith():
    handler = patterns.PatternsHandler()
    decorator = handler.startswith('ping')

    def view(): 'pong'
    assert callable(decorator)
    assert decorator(view) == view
    assert handler.registered

@@ -54,35 +54,20 @@
 er_check
-_positive_match
 ():%0A
+
     mess
@@ -422,39 +422,24 @@
 ndler_check_
-positive_match_
 with_case_se
@@ -925,32 +925,305 @@
 age)%0A%0A%0Adef test_
+message_handler_check_negative_match_with_case_insensitive():%0A    message = type('Message', (), %7B'text': 'Ping'%7D)%0A    handler = patterns.MessageHandler(pattern='ping',%0A                                      case_sensitive=False)%0A    assert handler.check(message)%0A%0A%0Adef test_
 startswith_handl
@@ -1230,31 +1230,16 @@
 er_check
-_positive_match
 ():%0A    
@@ -1641,27 +1641,17 @@
 eck_
-positive_match_with
+with_case
 _sen
@@ -1934,16 +1934,21 @@
 ch_with_
+case_
 sensitiv
@@ -2189,16 +2189,22 @@
 _handler
+_check
 ():%0A    
@@ -2538,39 +2538,46 @@
 %0A    def view():
- 'pong'
+%0A        pass%0A
 %0A    assert call
@@ -2799,23 +2799,30 @@
  view():
- 'pong'
+%0A        pass%0A
 %0A    ass

Fix test names on test_patterns