I have no precise recipe for twitter (not having done exactly that until now), but given that OAuth has a specification describing the different possible flows, I'd try to enumerate each of them for the case at hand, and try to automate the interaction.
I have no precise recipe for twitter (not having done exactly that until now), but given that OAuth has a specification describing the different possible flows, I'd try to enumerate each of them for the case at hand, and try to automate the interaction. To guide you, here are a few pointers to relevant information: OAuth/Twitter FAQ Beginner's Guide to OAuth Twitter OAuth ruby example Developing OAuth clients in ruby Usually the flow for web based is different (as you have seen) whether the user has not given authorization to the client application: if the user has not yet given authorization to the client application then it is redirected to the service provider site at the service provider is the user was not already logged in it is required to authenticate with his credentials once authenticated at the service provider it is required to authorize or deny authorization to the client application/service once he has given the authorize response it is sent back to the client site which can then get an access token if the user had already authorized the client application/service then it can use the access token to bypass those steps and access users' data/API at the service provider.
It's over a year since the OP, but I recently found this article about using TwitterAuth and Cucumber that worked for me. blog.zerosum.org/2009/7/13/twitter-auth-....
Yeah, the secret sauce there is using FakeWeb to mock out the Twitter backend. Nice article. – Rob Jun 6 at 11:50.
I used mocking in my test cases. I tested manually, figured out what the responses should be, and overrode the ruby oAuth gem. Here is one test case (using Shoulda) for a successful tweet: context 'cork/tweet' do setup do response = Net::HTTPResponse.
New("1.1", 200, "") Net::HTTPResponse. Any_instance. Stubs(:body).
Returns JSON_RESPONSE OAuth::AccessToken. Any_instance. Stubs(:post).
Returns(response) post :create, :cork_id => @cork. Id, :message=>MESSAGE end should_respond_with :redirect should_change('Tweet. Count' , :by => 1) {Tweet.
Count} .. and so on JSON_RESPONSE is the answer I collected from my manual tests - I put a printf in lib/oauth/tokens/access_token. Rb:44:in `post' to capture the response. Otherwise this is almost impossible to test, because as you point out, Twitter has no way to deauthorize your application from the API, and acts differently if you have already authorized the application.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.