def run_twitter_sync(): try: data = twitter_sync.call_for_timeline_data_json() twitter_sync.sync_tweets_and_users_save(data) print(Tweet.objects.all()) except Exception as e: print("There was an error either connecting to Twitter API or syncing data. Check your security and screen_name info in settings.py: %s" % e)
def test_get_sync_twitter_user_timeline_save(self): self.data = twitter_sync.call_for_timeline_data_json() twitter_sync.sync_tweets_and_users_save(self.data) self.assertEquals(TwitterUser.objects.all().count(), 1) self.assertEquals(Tweet.objects.all().count(), 5)