예제 #1
0
  def test_oauth_handler_no_blogs(self):
    self.auth_entity = BloggerV2Auth(id='123', name='name', picture_url='pic',
                                     blogs_atom='x', user_atom='y', creds_json='z')
    self.auth_entity.put()

    resp = blogger.application.get_response(
      '/blogger/oauth_handler?auth_entity=%s' % self.auth_entity.key.urlsafe())
    self.assertEquals(302, resp.status_int)
    location = urlparse.urlparse(resp.headers['Location'])
    self.assertEquals('/', location.path)
    self.assertIn("Couldn't fetch your blogs", urllib.unquote(location.fragment))
예제 #2
0
  def setUp(self):
    super(BloggerTest, self).setUp()
    self.auth_entity = BloggerV2Auth(name='name',
                                     blog_ids=['111'],
                                     blog_hostnames=['my.blawg'],
                                     picture_url='http://pic')
    self.client = self.mox.CreateMock(BloggerClient)

    self.comment = data.Comment()
    self.comment.id = util.Struct(
      text='tag:blogger.com,1999:blog-111.post-222.comment-333')
    self.comment.to_string = lambda: '<foo></foo>'
예제 #3
0
 def test_new_oauth_dropins_error(self):
   """Blogger is special cased in oauth-dropins: when login succeeds but then
   an authenticated API call fails, it returns an empty auth entity key, which
   we can differentiate from a user decline because oauth-dropins can't
   currently intercept Blogger declines.
   """
   resp = blogger.application.get_response('/blogger/oauth_handler')
   self.assertEquals(302, resp.status_int)
   location = urlparse.urlparse(resp.headers['Location'])
   self.assertEquals('/', location.path)
   self.assertIn("Couldn't fetch your blogs", urllib.unquote(location.fragment))
   self.assertEquals(0, BloggerV2Auth.query().count())
   self.assertEquals(0, Blogger.query().count())