Thanks, Dan. This is code I inherited, and it wasn't clear to me whether it was something inherent to Mojolicious or in the way the project was written. Thanks for pointing me in the right direction. -Randall
On Wednesday, June 1, 2016 at 5:48:46 PM UTC-4, Dan Book wrote: > > The test is identifying that the post successfully occurred and the second > test verifies it got a 200 OK response. If there is some other way you are > indicating failure, you'll need to check that as well. You can access the > response object after the post_ok call via $t->tx->res. > > On Wed, Jun 1, 2016 at 5:21 PM, Randall Sindlinger <[email protected] > <javascript:>> wrote: > >> I might be missing something trivial here... but how can I know that a >> POST was truly successful? >> >> I'm writing some testing code with Test::Mojo and friends, and had this >> snippet >> $t->ua->max_redirects(1); #post produces a redirect >> $t->post_ok("/relationship" => json => {identifer => >> 'test:roughlyEquivalent', >> description => "Close, but not >> quite"}) >> ->status_is(200, "Add test:roughlyEquivalent"); >> >> $t->get_ok("/relationship/test:roughlyEquivalent")->status_is(200, >> "test:roughlyEquivalent >> now exists"); >> >> >> The status of the get_ok test failed, getting a 404. It took me a while >> to see that I'd mis-typed "identifier" in the post_ok line. >> >> It feels wrong that I can have a key misspelled, causing the insert to >> fail, and still get a success message back. >> Is there a deeper level of testing (or validation) available someplace? >> >> Thanks, >> -Randall >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Mojolicious" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected] <javascript:>. >> To post to this group, send email to [email protected] >> <javascript:>. >> Visit this group at https://groups.google.com/group/mojolicious. >> For more options, visit https://groups.google.com/d/optout. >> > > -- You received this message because you are subscribed to the Google Groups "Mojolicious" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/mojolicious. For more options, visit https://groups.google.com/d/optout.
