def test_multiple_calls_with_same_word(self): msg = CommandMessage(original_text='.count ham', text='ham', sender='123_homer@localhost/Oklahomer') assert_that(hipchat_count(msg, {})) \ .described_as("First count returns 1") \ .is_equal_to('1') other_msg = CommandMessage(original_text='.count ham', text='ham', sender='other@localhost/Oklahomer') assert_that(hipchat_count(other_msg, {})) \ .described_as("Different counter for different message") \ .is_equal_to('1') assert_that(hipchat_count(msg, {})) \ .described_as("Same message results in incremented count") \ .is_equal_to('2') reset_msg = CommandMessage(original_text='.reset_count', text='', sender='123_homer@localhost/Oklahomer') assert_that(hipchat_reset_count(reset_msg, {})) \ .described_as(".reset_count command resets current count") \ .is_equal_to("restart counting") assert_that(hipchat_count(msg, {})) \ .described_as("Count restarts") \ .is_equal_to('1')
def test_multiple_calls_with_different_word(self): msg = CommandMessage(original_text='.count ham', text='ham', sender='123_homer@localhost/Oklahomer') assert_that(hipchat_count(msg, {})) \ .described_as("First count message returns 1") \ .is_equal_to('1') other_msg = CommandMessage(original_text='.count spam', text='spam', sender='123_homer@localhost/Oklahomer') assert_that(hipchat_count(other_msg, {})) \ .described_as("Second message with different content returns 1") \ .is_equal_to('1')
def test_valid(self): msg = CommandMessage(original_text='.count ham', text='ham', sender='123_homer@localhost/Oklahomer') assert_that(hipchat_count(msg, {})) \ .described_as(".count command increments count") \ .is_equal_to('1')