[Jifty-commit] r1195 - in jifty/trunk: lib/Jifty/Test/WWW

jifty-commit at lists.jifty.org jifty-commit at lists.jifty.org
Wed Jun 7 21:16:44 EDT 2006


Author: alexmv
Date: Wed Jun  7 21:16:43 2006
New Revision: 1195

Modified:
   jifty/trunk/   (props changed)
   jifty/trunk/lib/Jifty/Test/WWW/Mechanize.pm

Log:
 r13660 at zoq-fot-pik:  chmrr | 2006-06-07 21:12:24 -0400
  * Ability to send arbitrary actions from the Mech object, using the
 webservices API


Modified: jifty/trunk/lib/Jifty/Test/WWW/Mechanize.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Test/WWW/Mechanize.pm	(original)
+++ jifty/trunk/lib/Jifty/Test/WWW/Mechanize.pm	Wed Jun  7 21:16:43 2006
@@ -160,6 +160,36 @@
     return $input->value;
 }
 
+sub send_action {
+    my $self = shift;
+    my $class = shift;
+    my %args = @_;
+
+
+    my $uri = $self->uri->clone;
+    $uri->path("__jifty/webservices/yaml");
+
+    my $request = HTTP::Request->new(
+        POST => $uri,
+        [ 'Content-Type' => 'text/x-yaml' ],
+        Jifty::YAML::Dump(
+            {   path => $uri->path,
+                actions => {
+                    action => {
+                        moniker => 'action',
+                        class   => $class,
+                        fields  => \%args
+                    }
+                }
+            }
+        )
+    );
+    my $result = $self->request( $request );
+    my $content = eval { Jifty::YAML::Load($result->content)->{action} } || undef;
+    $self->back;
+    return $content;
+}
+
 # When it sees something like
 # http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd as a DOCTYPE, this will make
 # it open static/dtd/xhtml1-strict.dtd instead -- great for offline hacking!


More information about the Jifty-commit mailing list