Ejemplo n.º 1
0
    def test_get_all_since(self):
        user = User(name="username")
        recent_text = "recenttweet"
        recent_tweet = Tweet(text=recent_text, id=1337L, created_at=datetime.now(), user=user)
        recent_tweet.save()

        long_ago = datetime.now() - timedelta(days=100)
        recent_tweet = Tweet(text=recent_text, id=1337, created_at=datetime.now(), user=user)
        really_old_tweet = Tweet(id=1338L, text="oldtweet", created_at=long_ago, user=user)
        really_old_tweet.save()

        yesterday = datetime.now() - timedelta(days=1)
        recent_indexes = Keyword.get_all_since(yesterday)

        self.assertEquals(recent_indexes.count(), 1)
        self.assertEquals(recent_indexes[0]["keyword"], recent_text)
Ejemplo n.º 2
0
 def test_get_all_since_no_data(self):
     yesterday = datetime.now() - timedelta(days=1)
     self.assertFalse(Keyword.get_all_since(yesterday))