Пример #1
0
 def test_create_unique_slug_for_each_tip(self):
     t = Tip()
     t.author = self.user
     t.title = 'Solução para Desligamento Rápido'
     t.body = '# halt'
     t.save()
     self.assertEquals('solucao-para-desligamento-rapido', t.slug_title)
     
     t = Tip()
     t.author = self.user
     t.title = 'Solução para Desligamento Rápido'
     t.body = 'Digite halt no terminal'
     t.save()
     self.assertEquals('solucao-para-desligamento-rapido-1', t.slug_title)
Пример #2
0
 def test_create_tip_with_two_tags(self):
     t = Tip()
     t.author = self.user
     t.title = 'Share files using samba3'
     t.body = 'Using samba you will can be share files on network.'
     t.tags = 'samba linux'
     t.save()
     self.assertEquals('samba linux', t.tags)
Пример #3
0
def add_tips(tweets):
    tweets = tweets if isinstance(tweets, list) else tweets.items()
    for tw in tweets:
        session.add(
            Tip(tweetid=tw.id,
                text=tw.text,
                created=tw.created_at,
                likes=tw.favorite_count,
                retweets=tw.retweet_count))
    session.commit()