chicks / sugarcrm

A ruby based REST Client for SugarCRM
MIT License
90 stars 64 forks source link

set_document_revision test fails #38

Closed frugardc closed 13 years ago

frugardc commented 13 years ago

Loaded suite unit/sugar_document_test Started E Finished in 0.780885 seconds.

1) Error: test: A SugarCRM.connection should Update a document revision. (TestDocumentAttachment): ArgumentError: wrong number of arguments (3 for 2)

1 tests, 1 assertions, 0 failures, 1 errors

Is it possible this is because I am using version 6.0.3? I tried omitting the second argument, which seems to make it work, but I get a "Invalid File Reference" when trying to bring up the document.

chicks commented 13 years ago

No, we use the v2 API which hasn't changed in years, plus this is a runtime exception from Ruby. REST issues generally manifest as an UnhandledException.

Are you passing the wrong number of arguments to one of your methods? The actual set_document_revision call accepts 3 parameters.

frugardc commented 13 years ago

It's this method thats failing...

assert SugarCRM.connection.set_document_revision(d.id, d.revision, {:file => file, :file_name => "m_accounts.csv"})

When I change that to...

assert SugarCRM.connection.set_document_revision(d.id, {:file => file, :file_name => "m_accounts.csv"})

all of the tests pass, but the document is not uploaded correctly.

chicks commented 13 years ago

Hrm.. are you using HEAD or 0.9.11?

frugardc commented 13 years ago

0.9.11

chicks commented 13 years ago

Let me try 0.9.11 against 6.0.3 Enterprise.

chicks commented 13 years ago

Oh, heh. I just realized that set_document_revision is broken in 0.9.11. It works in HEAD though... Sorry :P

chicks commented 13 years ago

If you want to hotfix it, just copy the set_document_revision.rb file from head... it should work no problem.

frugardc commented 13 years ago

Is there any way to do this with Bundler?

chicks commented 13 years ago

If you are using this in a rails environment, you can just modify the project Gemfile to point at the git repo. For system gems, I'm not sure...

Here's the link to the file:

https://github.com/chicks/sugarcrm/blob/master/lib/sugarcrm/connection/api/set_document_revision.rb

I'll cut a gem this weekend.

chicks commented 13 years ago

Erm, copying the file won't work unless you change the session reference after you copy the file...

From: "session": "#{@sugar_session_id}",

To: "session": "#{@session.id}",

frugardc commented 13 years ago

I see this works in HEAD. Should it be closed now or wait until the 0.9.12 release?

chicks commented 13 years ago

It can wait until 0.9.12. Better to leave it open in case someone else finds the same problem.

davidsulc commented 13 years ago

0.9.12 has been released. When you get the chance, can you confirm this version solves the issue?

frugardc commented 13 years ago

Just verified it works in 0.9.12. Thanks. Closing.