FakeWeb useage for Order/Checkout model testing

14 views
Skip to first unread message

pjammer

unread,
Jul 21, 2009, 10:07:10 AM7/21/09
to FakeWeb
Hi all,

I have a few questions about different topics, so i'll be posting one
or two more notes,as an fyi. Here's the first.

I'm using Active_Merchant to help create a recurring payment order
page, on my app. I thought I'd also like to stretch my BDDing that
i've done to this point and include fakeweb for all the calls out to
the paypal sandbox, which would be made when i ran these tests.

I guess what i'm having trouble understanding is what url do i fake?
how do i know where paypal goes, after i hit their first url? also
how would i capture the information being sent back to my callback
url, which would have all the fun response params inside.

For me, fakeweb looks easy enough to use, but it's rather hard to
determine what information i need and what url to fake, and how do i
find the other urls in which i don't see, and say paypal uses on their
end?

Just trying to 'get it' and thanks.

joshua clingenpeel

unread,
Jul 22, 2009, 1:19:11 PM7/22/09
to fakewe...@googlegroups.com
On Tue, Jul 21, 2009 at 7:07 AM, pjammer<super...@linuxtitans.com> wrote:
>
> Hi all,
>

Hello!

> I have a few questions about different topics, so i'll be posting one
> or two more notes,as an fyi. Here's the first.
>
> I'm using Active_Merchant to help create a recurring payment order
> page, on my app.  I thought I'd also like to stretch my BDDing that
> i've done to this point and include fakeweb for all the calls out to
> the paypal sandbox, which would be made when i ran these tests.
>
> I guess what i'm having trouble understanding is what url do i fake?
> how do i know where paypal goes, after i hit their first url?  also
> how would i capture the information being sent back to my callback
> url, which would have all the fun response params inside.
>

So here's how I use Fakeweb - I do the thing I want to fake, and note
how I construct my request, and then what I actually get in response.
I don't worry about what happens in the background after I make my
request. So when I'm dealing with a site's API (as in the Nanowrimo
gem on rubyforge), I know the URL that I'm going to want to get data
back on, and I have a saved copy of what I'd typically get as a
response. Then I tell Fakeweb to watch out for that URL, and if it
finds it, then give me back the file I have saved locally.

Now for what I assume is an asynchronous process: You'd basically want
to mock out your initial request and any confirmation response that
Paypal would send, and then mock out a response to your callback
method with the saved local copy.

> For me, fakeweb looks easy enough to use, but it's rather hard to
> determine what information i need and what url to fake, and how do i
> find the other urls in which i don't see, and say paypal uses on their
> end?
>

I would say don't worry about things you don't see - you're not
testing Paypal, right? ;)

> Just trying to 'get it' and thanks.

I haven't worked with Active_Merchant or with the Paypal sandbox, so I
hope this information is helpful. Good luck!

> >
>

--
Josh
Sent from Seattle, Washington, United States
Reply all
Reply to author
Forward
0 new messages