Example #1
0
 def test_no_recipients(self):
     """Blow up elegantly if no recipients are supplied."""
     api = DebugBackend(self.api_token, self.api_secret,
                        consumer_token=self.consumer_token, 
                        consumer_secret=self.consumer_secret,
                        headline=self.headline, excerpt=self.excerpt,
                        tweet=self.tweet, url=self.url,
                        url_title=self.url.title, 
                        url_description=self.url_description,
                        image_url=self.image_url,
                        image_url_title=self.url_title,
                        image_url_description=self.image_url_description)
     with self.assertRaises(ShareError) as cm:
         api.send_message()
     self.assertEqual(cm.exception.msg, 'No recipients to send to.')
Example #2
0
 def test_debugbackend_send_message(self):
     """Tests that send message sends messages."""
     api = DebugBackend(self.api_token, self.api_secret,
                        consumer_token=self.consumer_token, 
                        consumer_secret=self.consumer_secret,
                        headline=self.headline, excerpt=self.excerpt,
                        tweet=self.tweet, url=self.url,
                        url_title=self.url.title, 
                        url_description=self.url_description,
                        image_url=self.image_url,
                        image_url_title=self.url_title,
                        image_url_description=self.image_url_description)
     api.to = self.to
     result = api.send_message()
     self.assertIn(self.api_token, result)
     self.assertIn(self.api_secret, result)
     self.assertIn(self.consumer_token, result)        
     self.assertIn(self.consumer_secret, result)        
     self.assertIn(self.headline, result)        
     self.assertIn(self.excerpt, result)        
     self.assertIn(self.tweet, result)
     self.assertIn(self.to, result)
Example #3
0
 def test_debugbackend_share(self):
     """Tests that the debug backend works."""
     api = DebugBackend(self.api_token, 
                         self.api_secret,
                         consumer_token=self.consumer_token, 
                         consumer_secret=self.consumer_secret,
                         headline=self.headline, excerpt=self.excerpt,
                         tweet=self.tweet, url=self.url,
                         url_title=self.url.title, 
                         url_description=self.url_description,
                         image_url=self.image_url,
                         image_url_title=self.url_title,
                         image_url_description=self.image_url_description)
     api.to = self.to
     # Do a share
     result = api.share()
     # Now make sure the results were correct
     self.assertIn(self.api_token, result)
     self.assertIn(self.api_secret, result)
     self.assertIn(self.consumer_token, result)        
     self.assertIn(self.consumer_secret, result)        
     self.assertIn(self.headline, result)        
     self.assertIn(self.excerpt, result)        
     self.assertIn(self.tweet, result)