def test_get_user(): i = rint() user = User.get_or_create(i, "pete", "bigpete" + (str(i))) assert user is not None sp = "smallpete%s" % str(i) user2 = User.get_or_create(i, "pete", sp) assert user == user2 small_pete = User.get(user_id=i) assert small_pete.mention_name == sp pete = User.get_by_nick(sp) assert pete == small_pete
def get_user(self, message): connect() assert isinstance(message, Message) user = message.sender # user_id = user.user.split("_")[1] # hipchat_user = self.get_hipchat_user(user_id) # available on hipchat_user user = User.get_or_create(user.hipchat_id, user.name, user.nick) return user
def mkuser(): i = rint() return User.get_or_create(i, "test", "test" + str(i))