geekdeepak / gdata-ruby-util

Automatically exported from code.google.com/p/gdata-ruby-util
Apache License 2.0
0 stars 0 forks source link

test/tc_gdata_client_calendar fails #12

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create a test_config.yml: the username and password should be for a
*GOOGLE APPS* user, e.g., someone@yourdomain.com (NOT someone@gmail.com)
2. ruby test/tc_gdata_client_calendar.rb

What is the expected output? PASS What do you see instead?

FAIL:

  1) Failure:
test_get_all_calendars(TC_GData_Client_Calendar)
[test/tc_gdata_client_calendar.rb:29]:
Must not be a redirect.
<200> expected but was
<302>.

What version of the product are you using? On what operating system?

gdata-ruby-util: 1.1.1
Ruby 1.8.6 (fails on hoang's version for 1.9.1, too --
http://code.google.com/u/hoanga/)
OS/X 10.5

Please provide any additional information below.

I don't understand the redirect strategy in general. I could patch the
library to follow the redirect, but am not sure if this is the best strategy.

Original issue reported on code.google.com by john.g.norman@gmail.com on 29 Apr 2010 at 2:34

GoogleCodeExporter commented 9 years ago
P.S. I think the reason this is broken is because
GData::Client::Calendar#make_request is obviously wrong.

It claims to want to do a redirect, but the new request is to the exact same 
original
url.

      def make_request(method, url, body = '', retries = 4)
        response = super(method, url, body)
        if response.status_code == 302 and retries > 0
          @session_cookie = response.headers['set-cookie']
          return self.make_request(method, url, body, 
            retries - 1)
        else
          return response
        end
      end

E.g., should be something like

          @session_cookie = response.headers['set-cookie']
          redirect_url = response.headers['location']
          return self.make_request(method, redirect_url, body, 
            retries - 1)

Original comment by john.g.norman@gmail.com on 29 Apr 2010 at 2:52