Esempio n. 1
0
 def test_post_interacts_with_twitter_api(self):
     fake_tweepy.returnid = 12345
     metadata = post_twitter('this is a test message')
     self.assertEquals(1, len(fake_tweepy.oauths))
     self.assertEquals('CONSUMER_KEY', fake_tweepy.oauths[0].consumer_key)
     self.assertEquals('CONSUMER_SECRET', fake_tweepy.oauths[0].consumer_secret)
     self.assertEquals('ACCESS_TOKEN', fake_tweepy.oauths[0].access_token)
     self.assertEquals('ACCESS_TOKEN_SECRET', fake_tweepy.oauths[0].access_token_secret)
     self.assertEquals(1, len(fake_tweepy.apis))
     self.assertEquals('this is a test message', fake_tweepy.apis[0].status)
     self.assertEquals('http://www.twitter.com/desmondrivet/status/12345',
                       metadata['twitterpost'])
Esempio n. 2
0
def post_social(post, networks=None, link=None):
    """Post the supplied post to the supplied social networks.  If none are
    supplied, use the YAWT_MICROPOST_NETWORKS configuration
    """
    networks = networks or current_app.config['YAWT_MICROPOST_NETWORKS']
    metadata = {}
    for network in networks:
        if network == 'facebook':
            metadata.update(post_fb(post, link))
        elif network == 'twitter':
            metadata.update(post_twitter(post))
    return metadata