Example #1
0
    def test_multiple_calls_with_same_word(self):
        msg = CommandMessage(original_text='.count ham',
                             text='ham',
                             sender='U06TXXXXX')
        assert_that(slack_count(msg, {})) \
            .described_as("First count returns 1") \
            .is_equal_to('1')

        other_msg = CommandMessage(original_text='.count ham',
                                   text='ham',
                                   sender='U06TYYYYYY')
        assert_that(slack_count(other_msg, {})) \
            .described_as("Different counter for different message") \
            .is_equal_to('1')

        assert_that(slack_count(msg, {})) \
            .described_as("Same message results in incremented count") \
            .is_equal_to('2')

        reset_msg = CommandMessage(original_text='.reset_count',
                                   text='',
                                   sender='U06TXXXXX')
        assert_that(slack_reset_count(reset_msg, {})) \
            .described_as(".reset_count command resets current count") \
            .is_equal_to("restart counting")

        assert_that(slack_count(msg, {})) \
            .described_as("Count restarts") \
            .is_equal_to('1')
Example #2
0
    def test_multiple_calls_with_same_word(self):
        msg = CommandMessage(original_text='.count ham',
                             text='ham',
                             sender='U06TXXXXX')
        assert_that(slack_count(msg, {})) \
            .described_as("First count returns 1") \
            .is_equal_to('1')

        other_msg = CommandMessage(original_text='.count ham',
                                   text='ham',
                                   sender='U06TYYYYYY')
        assert_that(slack_count(other_msg, {})) \
            .described_as("Different counter for different message") \
            .is_equal_to('1')

        assert_that(slack_count(msg, {})) \
            .described_as("Same message results in incremented count") \
            .is_equal_to('2')

        reset_msg = CommandMessage(original_text='.reset_count',
                                   text='',
                                   sender='U06TXXXXX')
        assert_that(slack_reset_count(reset_msg, {})) \
            .described_as(".reset_count command resets current count") \
            .is_equal_to("restart counting")

        assert_that(slack_count(msg, {})) \
            .described_as("Count restarts") \
            .is_equal_to('1')
Example #3
0
    def test_multiple_calls_with_different_word(self):
        msg = CommandMessage(original_text=".count ham", text="ham", sender="U06TXXXXX")
        assert_that(slack_count(msg, {})).described_as("First count message returns 1").is_equal_to("1")

        other_msg = CommandMessage(original_text=".count spam", text="spam", sender="U06TXXXXX")
        assert_that(slack_count(other_msg, {})).described_as(
            "Second message with different content returns 1"
        ).is_equal_to("1")
Example #4
0
    def test_multiple_calls_with_different_word(self):
        msg = CommandMessage(original_text='.count ham',
                             text='ham',
                             sender='U06TXXXXX')
        assert_that(slack_count(msg, {})) \
            .described_as("First count message returns 1") \
            .is_equal_to('1')

        other_msg = CommandMessage(original_text='.count spam',
                                   text='spam',
                                   sender='U06TXXXXX')
        assert_that(slack_count(other_msg, {})) \
            .described_as("Second message with different content returns 1") \
            .is_equal_to('1')
Example #5
0
    def test_multiple_calls_with_different_word(self):
        msg = CommandMessage(original_text='.count ham',
                             text='ham',
                             sender='U06TXXXXX')
        assert_that(slack_count(msg, {})) \
            .described_as("First count message returns 1") \
            .is_equal_to('1')

        other_msg = CommandMessage(original_text='.count spam',
                                   text='spam',
                                   sender='U06TXXXXX')
        assert_that(slack_count(other_msg, {})) \
            .described_as("Second message with different content returns 1") \
            .is_equal_to('1')
Example #6
0
    def test_multiple_calls_with_same_word(self):
        msg = CommandMessage(original_text=".count ham", text="ham", sender="U06TXXXXX")
        assert_that(slack_count(msg, {})).described_as("First count returns 1").is_equal_to("1")

        other_msg = CommandMessage(original_text=".count ham", text="ham", sender="U06TYYYYYY")
        assert_that(slack_count(other_msg, {})).described_as("Different counter for different message").is_equal_to("1")

        assert_that(slack_count(msg, {})).described_as("Same message results in incremented count").is_equal_to("2")

        reset_msg = CommandMessage(original_text=".reset_count", text="", sender="U06TXXXXX")
        assert_that(slack_reset_count(reset_msg, {})).described_as(
            ".reset_count command resets current count"
        ).is_equal_to("restart counting")

        assert_that(slack_count(msg, {})).described_as("Count restarts").is_equal_to("1")
Example #7
0
 def test_valid(self):
     msg = CommandMessage(original_text='.count ham',
                          text='ham',
                          sender='U06TXXXXX')
     assert_that(slack_count(msg, {})) \
         .described_as(".count command increments count") \
         .is_equal_to('1')
Example #8
0
 def test_valid(self):
     msg = CommandMessage(original_text='.count ham',
                          text='ham',
                          sender='U06TXXXXX')
     assert_that(slack_count(msg, {})) \
         .described_as(".count command increments count") \
         .is_equal_to('1')
Example #9
0
 def test_valid(self):
     msg = CommandMessage(original_text=".count ham", text="ham", sender="U06TXXXXX")
     assert_that(slack_count(msg, {})).described_as(".count command increments count").is_equal_to("1")