def test_post_interacts_with_facebook_api(self): fake_facebook.returnval = {'id': '1234_5678'} metadata = post_fb('this is a test message') self.assertEquals(1, len(fake_facebook.graphapis)) self.assertEquals('me/feed', fake_facebook.graphapis[0].target) self.assertEquals('this is a test message', fake_facebook.graphapis[0].message) self.assertEquals('http://www.facebook.com/desmond.rivet/posts/5678', metadata['fbpost'])
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