[html-formfu] CatalystX::Controller::ExtJS::REST tests

Moritz Onken onken at houseofdesign.de
Wed Apr 15 07:49:35 GMT 2009


Try updating Test::WWW::Mechanize::Catalyst first.


Am 14.04.2009 um 23:33 schrieb Mario Minati:

> Am Dienstag 14 April 2009 22:55:33 schrieb Moritz Onken:
>> Hm, interesting. Seems like your test is not following the redirect,
>> though it is present in
>> _headers->location. Does the test pass if you remove the ->previous
>> from line 30?
>
> Yes, all 18 test pass ok.
>
>> could you make a "cpan upgrade" to upgrade all modules? Could be
>> libwww-perl or something?!
>
> Ok, but that'll take some hours :-)
>
>
> Read you tomorrow,
>
> Mario Minati
>
>> Am 14.04.2009 um 22:39 schrieb Mario Minati:
>>> Hi Moritz,
>>>
>>> now my understanding of testing Catalyst is a little better. :-)
>>>
>>> The user.t doesn't work for me, the problem with redirected request
>>> doesn't
>>> come up here.
>>>
>>> The output is:
>>> --snip--
>>> ok 1 - request list of users
>>> ok 2 - response is JSON response
>>> ok 3 - no results
>>> [info] *** Request 2 (2.000/s) [5763] [Tue Apr 14 22:28:07 2009] ***
>>> [debug] Body Parameters are:
>>> .-------------------------------------
>>> +--------------------------------------.
>>>
>>> | Parameter                           |
>>>
>>> Value                                |
>>> +-------------------------------------
>>> +--------------------------------------+
>>>
>>> | name                                |
>>>
>>> bar                                  |
>>>
>>> | password                            |
>>>
>>> foo                                  |
>>> '-------------------------------------
>>> +--------------------------------------'
>>> [debug] "POST" request for "user" from "127.0.0.1"
>>> [debug] Path is "/user/object"
>>> [debug] I would have deserialized, but there was nothing in the  
>>> body!
>>> [debug] Serializing with Catalyst::Action::Serialize::JSON
>>> [info] Request took 0.114814s (8.710/s)
>>> .----------------------------------------------------------------
>>> +-----------.
>>>
>>> | Action                                                         |
>>>
>>> Time      |
>>> +----------------------------------------------------------------
>>> +-----------+
>>>
>>> | /user/begin                                                    |
>>>
>>> 0.004265s |
>>>
>>> | /user/object                                                   |
>>>
>>> 0.008799s |
>>>
>>> | /user/end                                                      |
>>>
>>> 0.001013s |
>>> '----------------------------------------------------------------
>>> +-----------'
>>>
>>> Can't call method "content" on an undefined value at t/rest/user.t
>>> line 30.
>>> # Looks like you planned 18 tests but ran 3.
>>> # Looks like your test exited with 9 just after 3.
>>> --snap--
>>>
>>> Dumping $res from line 23 of user.t gives:
>>> $VAR1 = bless( {
>>>                '_protocol' => 'HTTP/1.1',
>>>                '_content' => '{"success":1,"data":
>>> {"password":"foo","name":"bar","id":null}}',
>>>                '_raw_content' => '{"success":1,"data":
>>> {"password":"foo","name":"bar","id":null}}',
>>>                '_rc' => 201,
>>>                '_headers' => bless( {
>>>                                       'x-catalyst' => '5.71000',
>>>                                       'content-base' => bless( do{\
>>> (my $o
>>> = 'http://localhost/user')}, 'URI::http' ),
>>>                                       'location'
>>> => 'http://localhost/user/1',
>>>                                       'date' => 'Tue, 14 Apr 2009
>>> 20:30:06
>>> GMT',
>>>                                       'status' => '201',
>>>                                       'vary' => 'Content-Type',
>>>                                       'content-length' => '62',
>>>                                       'content-type' =>
>>> 'application/json'
>>>                                     }, 'HTTP::Headers' ),
>>>                '_msg' => 'Created',
>>>                '_request' => bless( {
>>>                                       '_content' =>
>>> 'name=bar&password=foo',
>>>                                       '_uri' => $VAR1->{'_headers'}
>>> {'content-base'},
>>>                                       '_headers' => bless( {
>>>                                                              'user-
>>> agent'
>>> => 'WWW-Mechanize/1.54',
>>>
>>> 'content-type'
>>> => 'application/x-www-form-urlencoded',
>>>                                                               
>>> 'accept'
>>> => 'application/json',
>>>
>>> 'accept-encoding'
>>> => 'gzip',
>>>
>>> 'content-length'
>>> => 21,
>>>                                                              'host'
>>> => 'localhost',
>>>
>>> 'referer'
>>> => 'http://localhost/users'
>>>                                                            },
>>> 'HTTP::Headers' ),
>>>                                       '_method' => 'POST',
>>>                                       '_uri_canonical' =>
>>> $VAR1->{'_headers'}{'content-base'}
>>>                                     }, 'HTTP::Request' )
>>>              }, 'HTTP::Response' );
>>>
>>> I didn't paste the dump of $mech, but I don't see the redirect.
>>>
>>>
>>> I#m useing the SVN versions of HTML-FormFu, HTML-FormFu-ExtJS and
>>> HTML-FormFu-Model-DBIC.
>>>
>>>
>>> Greets,
>>>
>>> Mario Minati
>>>
>>> Am Montag 13 April 2009 21:21:13 schrieben Sie:
>>>> Am Samstag 11 April 2009 21:48:10 schrieb Moritz Onken:
>>>>>> Hi Moritz,
>>>>>>
>>>>>> the suite looks good so far, I just read the code and gives quite
>>>>>> important
>>>>>> comments ('redirect' :roll:).
>>>>>>
>>>>>> The suite is not meant to run automatically on make test, right?
>>>>>
>>>>> Maybe we have to tweak Makefile.PL but they should run
>>>>> automatically.
>>>>> I guess we need "tests_recursive;" in Makefile.PL
>>>>
>>>> Ok
>>>>
>>>>>> Do you have a special suggestion on howto include all the SVN
>>>>>> FormFu
>>>>>> modules
>>>>>> into lib? Currently I have quite some -I options.
>>>>>
>>>>> I usually export the PERL5LIB variable which is read by perl.
>>>>> Is there more than the svn version of FormFu::ExtJS that we depend
>>>>> on?
>>>>
>>>> Actually I have an old FormFu installed via CPAN and am useing SVN
>>>> of all
>>>> FormFu related modules.
>>>>
>>>> Greets,
>>>>
>>>> Mario Minati
>>>>
>>>>> Am 11.04.2009 um 21:17 schrieb Mario Minati:
>>>>>> Hi Moritz,
>>>>>>
>>>>>> the suite looks good so far, I just read the code and gives quite
>>>>>> important
>>>>>> comments ('redirect' :roll:).
>>>>>>
>>>>>> The suite is not meant to run automatically on make test, right?
>>>>>>
>>>>>> Do you have a special suggestion on howto include all the SVN
>>>>>> FormFu
>>>>>> modules
>>>>>> into lib? Currently I have quite some -I options.
>>>>>>
>>>>>>
>>>>>> Happy Easter,
>>>>>>
>>>>>> Mario Minati
>>>>>>
>>>>>> Am Freitag 10 April 2009 14:21:02 schrieb Moritz Onken:
>>>>>>> Hi,
>>>>>>>
>>>>>>>
>>>>>>> I commited the test suite and created a test which is located in
>>>>>>> t/
>>>>>>> rest/user.yml.
>>>>>>>
>>>>>>> I think this is a good start for new tests and works pretty good
>>>>>>> so
>>>>>>> far.
>>>>>>> I added a few comments to the test so you can understand why
>>>>>>> certain
>>>>>>> things happen or don't.
>>>>>>>
>>>>>>> I usually run tests like this:
>>>>>>>
>>>>>>> CatalystX-Controller-ExtJS mo$ perl -Ilib t/rest/user.yml
>>>>>>>
>>>>>>> This way you get more output than using make test or prove.
>>>>>>>
>>>>>>> You don't need to deploy the schema or do something like that.
>>>>>>> This
>>>>>>> is
>>>>>>> handled in MyApp::Model::DBIC.
>>>>>>>
>>>>>>> Testing a REST-app sucks because all those HTTP::* and
>>>>>>> LWP::UserAgent
>>>>>>> modules
>>>>>>> don't support it very well. Example: Try to post form data using
>>>>>>> PUT.
>>>>>>>
>>>>>>> Have fun,
>>>>>>>
>>>>>>> moritz
>>>>>>>
>>>>>>> Am 10.04.2009 um 10:44 schrieb Mario Minati:
>>>>>>>> I wanted to step into the test creation for
>>>>>>>> CatalystX::Controller::ExtJS::REST
>>>>>>>> but am wondering how to start.
>>>>>>>>
>>>>>>>> Do we need to create a complete Cat test app, including sqlite
>>>>>>>> db to
>>>>>>>> test it
>>>>>>>> or is there maybe an easier way?
>>>>>>>>
>>>>>>>> Which module would be a good start to take modules as template.
>>>>>>>>
>>>>>>>>
>>>>>>>> I wish a nice Good Friday,
>>>>>>>>
>>>>>>>> Mario Minati
>>>>>>>>
>>>>>>>> _______________________________________________
>>>>>>>> HTML-FormFu mailing list
>>>>>>>> HTML-FormFu at lists.scsys.co.uk
>>>>>>>> http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/html-formfu
>>>>>>>
>>>>>>> _______________________________________________
>>>>>>> HTML-FormFu mailing list
>>>>>>> HTML-FormFu at lists.scsys.co.uk
>>>>>>> http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/html-formfu
>>>>>>
>>>>>> _______________________________________________
>>>>>> HTML-FormFu mailing list
>>>>>> HTML-FormFu at lists.scsys.co.uk
>>>>>> http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/html-formfu
>>>>>
>>>>> _______________________________________________
>>>>> HTML-FormFu mailing list
>>>>> HTML-FormFu at lists.scsys.co.uk
>>>>> http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/html-formfu
>>>
>>> _______________________________________________
>>> HTML-FormFu mailing list
>>> HTML-FormFu at lists.scsys.co.uk
>>> http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/html-formfu
>>
>> _______________________________________________
>> HTML-FormFu mailing list
>> HTML-FormFu at lists.scsys.co.uk
>> http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/html-formfu
>
>
>
> _______________________________________________
> HTML-FormFu mailing list
> HTML-FormFu at lists.scsys.co.uk
> http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/html-formfu




More information about the HTML-FormFu mailing list