Hi John,

I'll give a look at the first two options.
I've already implemented some tests as you suggest in option 3 using
the rest-client gem,
but that way I had to start ruote-rest and the test suite separately.

Thanks a lot for the tips.
Best regards,

Gonzalo.







2009/7/22 John Mettraux <[email protected]>:
>
> On Wed, Jul 22, 2009 at 1:06 AM, Gonzalo<[email protected]> wrote:
>>
>> We 've tweaked ruote-rest a bit, so resources such as /workitems need
>> user authorization. A lot of logic depends on the current user which
>> is env['REMOTE_USER'].
>>
>> I'd like to write some test for this logic... I tried to extend the
>> tests that come with ruote-rest but I don't exactly know where could I
>> insert the Basic Authorization header in a request.
>>
>> I gave a look to 'test/ft_auth.rb' but still don't know how to handle
>> it. It seems that 'test/testbase.rb' loads the environment for the
>> tests but I guess it doesn't start a RackBasicAuth app...
>
> Hello Gonzalo,
>
> you have 3 alternatives (imo) :
>
> 1) set the REMOTE_USER in your test :
>
>  get('/workitems', nil, 'REMOTE_USER' => 'toto')
>
> 2) wire the authentication in the test app :
>
> with authentication :
>
>  http://github.com/jmettraux/ruote-rest/blob/5467a3e97e70bee7a89c02ef2939518d3ab0e6d4/lib/start.rb#L88-99
>
> no authentication :
>
>  http://github.com/jmettraux/ruote-rest/blob/5467a3e97e70bee7a89c02ef2939518d3ab0e6d4/test/testbase.rb#L44-46
>
> 3) use an http client (like http://github.com/toland/patron/) to run
> test against a running ruote-rest. This is a bit more bulky.
>
>
> Hope this will help, best regards,
>
> --
> John Mettraux   -   http://jmettraux.wordpress.com
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
you received this message because you are subscribed to the "ruote users" group.
to post : send email to [email protected]
to unsubscribe : send email to [email protected]
more options : http://groups.google.com/group/openwferu-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to