Beispiel #1
0
def test_process_karma_produces_correct_output_for_decrease(
        mock_update_function):
    sent_message = MockMessage('<@9876543210> --', mock_author)
    karma_message = message.Message(sent_message)
    with mock.patch('karma.message.db.add_karma_event', return_value=None):
        response = karma_message.process_karma(mock_author)

    assert mock_update_function.called
    assert response == "<@9876543210>'s karma has decreased to -14"
Beispiel #2
0
def send_karma_message(mock_db, content):
    sent_message = MockMessage(content, mock_author)
    karma_msg = message.Message(sent_message)
    with mock.patch('karma.message.db.add_karma_event', return_value=None):
        karma_msg.process_karma(mock_author)
    return mock_db
Beispiel #3
0
def test_find_no_karma_in_invalid_message(invalid_input):
    sent_message = MockMessage(invalid_input, mock_author)
    karma_message = message.Message(sent_message)
    assert not karma_message.grants_karma()