示例#1
0
 def test_post_find_by_id(self):
   user = User.create(self.params['username'],self.params['password'])
   Post.create(user,self.params['post'])
   post_found = Post.find_by_id(1)
   self.assertEqual(1,post_found.id)
   self.assertEqual(user.id,int(post_found.user_id)) #shouldn't need int()
   self.assertEqual(self.params['username'],post_found.user.username)
示例#2
0
 def test_dispatch_post_to_followers(self):
   user_to_follow = User.create('anonymous','password')
   me = User.create(self.params['username'],self.params['password'])
   me.follow(user_to_follow)
   Post.create(user_to_follow,self.params['post'])
   self.assertEqual(1,len(me.timeline()))
   self.assertEqual(1,len(me.timeline()))
示例#3
0
 def test_post_find_by_id(self):
   user = User.create(self.params['username'],self.params['password'])
   Post.create(user,self.params['post'])
   post_found = Post.find_by_id(1)
   self.assertEqual(1,post_found.id)
   self.assertEqual(user.id,int(post_found.user_id)) #shouldn't need int()
   self.assertEqual(self.params['username'],post_found.user.username)
示例#4
0
 def test_dispatch_post_to_followers(self):
     user_to_follow = User.create('anonymous', 'password')
     me = User.create(self.params['username'], self.params['password'])
     me.follow(user_to_follow)
     Post.create(user_to_follow, self.params['post'])
     self.assertEqual(1, len(me.timeline()))
     self.assertEqual(1, len(me.timeline()))
示例#5
0
文件: app.py 项目: wightman/speakeasy
def post(user):
  try:
    content = bottle.request.POST['content']
    Post.create(user, content)
  except KeyError, e:
    pass
示例#6
0
 def test_create_post_with_mention(self):
   user = User.create(self.params['username'],self.params['password'])
   content_with_mention = self.params['post'] + '@' + self.params['username']
   Post.create(user,content_with_mention)
   self.assertEqual(1,len(user.mentions()))
示例#7
0
 def test_create_post(self):
   user = User.create(self.params['username'],self.params['password'])
   Post.create(user,self.params['post'])
   self.assertEqual(1,len(user.posts()))
   self.assertEqual(1,user.posts()[0].id)
   self.assertEqual(self.params['post'],user.posts()[0].content)
示例#8
0
 def test_create_post_with_mention(self):
     user = User.create(self.params['username'], self.params['password'])
     content_with_mention = self.params['post'] + '@' + self.params[
         'username']
     Post.create(user, content_with_mention)
     self.assertEqual(1, len(user.mentions()))
示例#9
0
 def test_create_post(self):
     user = User.create(self.params['username'], self.params['password'])
     Post.create(user, self.params['post'])
     self.assertEqual(1, len(user.posts()))
     self.assertEqual(1, user.posts()[0].id)
     self.assertEqual(self.params['post'], user.posts()[0].content)
示例#10
0
def post(user):
    content = bottle.request.POST['content']
    Post.create(user, content)
    bottle.redirect('/home')
示例#11
0
def post(user):
    try:
        content = bottle.request.POST['content']
        Post.create(user, content)
    except KeyError, e:
        pass
示例#12
0
文件: app.py 项目: aiqier/retwis-py
def post(user):
  content = bottle.request.POST['content']
  Post.create(user, content)
  bottle.redirect('/home')