Example #1
0
def test_buy_without_enough_money(app):
    app.send_msg('/buy_2')
    app.assert_sent('You don\'t have enough money')

    # check you haven't lost any money
    app.send_msg('/status')
    app.assert_sent(
        'You are standing in the middle of šŸØ Tavern, with 40.0 gold in your pocket, and the following items in your backpack:\nnothing')
Example #2
0
def test_chat_in_tavern(app):
    # two players must be in tavern, so register a new player
    app.send_msg('/start', chat_id=9)
    app.mock_bot.reset_mock()
    
    # send a message when standing in the tavern, other players should hear it
    app.send_msg('/say Hi', chat_id=app.chat_id)

    # check if the newbie heard the greeting
    app.assert_sent('Tester said "Hi"', chat_id=9)
Example #3
0
def test_list_things_to_buy(app):
    # you start in the tavern
    app.send_msg('/list')
    app.assert_sent(
        'There is nothing for sale here. Try /where to shop somewhere else')

    # you go to the baker
    app.send_msg('/go_2')
    app.send_msg('/list')
    app.assert_sent('šŸž Bread - 5 gold /buy_1\n\tFlour, water, yeast\n')
Example #4
0
def test_where(app):
    app.send_msg('/where')
    app.assert_sent('šŸØ Tavern /go_1\nšŸ‘Ø Baker Barry /go_2\nšŸ›  Old Ironworks /go_3')
Example #5
0
def test_go(app):
    app.send_msg('/go_3')
    app.send_msg('/status')
    app.assert_sent(
        'You are standing in the middle of šŸ›  Old Ironworks, with 40.0 gold in your pocket, and the following items in your backpack:\nnothing')
Example #6
0
def test_buy(app):
    app.send_msg('/buy_1')
    app.send_msg('/status')
    app.assert_sent(
        'You are standing in the middle of šŸØ Tavern, with 35.0 gold in your pocket, and the following items in your backpack:\n1x šŸž Bread')
Example #7
0
def test_status(app):
    app.send_msg('/status')
    app.assert_sent(
        'You are standing in the middle of šŸØ Tavern, with 40.0 gold in your pocket, and the following items in your backpack:\nnothing')
Example #8
0
def test_registering_new_user(app):
    app.send_msg('/start', chat_id=9)
    app.send_msg('/status', chat_id=9)
    app.assert_sent(
        'You are standing in the middle of šŸØ Tavern, with 0.0 gold in your pocket, and the following items in your backpack:\nnothing', chat_id=9)