Example #1
0
    def test_user_page_private_twitter(self):
        auth_entity = TwitterAuth(
            id='foo',
            user_json=json.dumps({'protected': True}),
            token_key='',
            token_secret='',
        ).put()
        tw = twitter.Twitter(id='foo',
                             auth_entity=auth_entity,
                             features=['listen'])
        tw.put()

        resp = app.application.get_response(tw.bridgy_path())
        self.assertEquals(200, resp.status_int)
        self.assertIn('Your Twitter account is private!', resp.body)
        self.assertNotIn('most of your recent posts are private', resp.body)
Example #2
0
    def test_user_page_private_twitter(self):
        auth_entity = TwitterAuth(
            id='foo',
            user_json=json_dumps({'protected': True}),
            token_key='',
            token_secret='',
        ).put()
        tw = twitter.Twitter(id='foo',
                             auth_entity=auth_entity,
                             features=['listen'])
        tw.put()

        resp = self.client.get(tw.bridgy_path())
        self.assertEqual(200, resp.status_code)
        self.assertIn('Your Twitter account is private!',
                      resp.get_data(as_text=True))
        self.assertNotIn('most of your recent posts are private',
                         resp.get_data(as_text=True))
 def urlopen(self, url, **kwargs):
   """Wraps urllib2.urlopen() and adds an OAuth signature.
   """
   return TwitterAuth.signed_urlopen(
     url, self.access_token_key, self.access_token_secret, **kwargs)