def test_buying_event(self, irc_msg): user = User("bill.evans") user.update_cool_points(10) irc_response = irc_msg("bill.evans", "!buy gcc") result = CommandRouter(irc_response, logger).build_response() last_event = UserEvent.last() assert last_event["user"] == "bill.evans" assert last_event["msg"] == "!buy gcc"
def test_count(self): assert UserEvent.count() == 0 subject = UserEvent( user="******", command="me", msg="!me", result="Cool Result" ) subject.save() assert UserEvent.count() == 1 user_event = UserEvent.last() assert user_event["user"] == "beginbot" assert user_event["command"] == "me" assert "created_at" in user_event
def test_user_events(self, irc_msg): user = User("bill.evans") miles = User("miles.davis") miles.save() irc_response = irc_msg("bill.evans", "!top8 miles.davis") result = CommandRouter(irc_response, logger).build_response() last_event = UserEvent.last() assert last_event["user"] == "bill.evans" assert last_event["msg"] == "!top8 miles.davis" assert last_event[ "result"] == "@miles.davis is now in @bill.evans's Top 8!" assert last_event["command"] == "top8"