журнал (shhh) wrote in changelog,
журнал
shhh
changelog

[livejournal] r22705: LJSUP-13330: XMLRPC tests actualization

Committer: nnikulochkina
LJSUP-13330: XMLRPC tests actualization
U   trunk/cgi-bin/LJ/Test.pm
Modified: trunk/cgi-bin/LJ/Test.pm
===================================================================
--- trunk/cgi-bin/LJ/Test.pm	2012-08-20 13:58:57 UTC (rev 22704)
+++ trunk/cgi-bin/LJ/Test.pm	2012-08-21 07:35:14 UTC (rev 22705)
@@ -16,6 +16,13 @@
 
 use LJ::ModuleCheck;
 
+use Data::Dumper;
+
+use Class::Autouse qw (
+                       LJ::OAuth::AccessToken
+                       LJ::Comment
+                       );
+
 # TODO: use EXPORT_OK instead, do not clutter the caller's namespace
 # unless asked to specifically
 our @EXPORT = qw(
@@ -260,7 +267,6 @@
     my $res = LJ::UserApps->add_application(%opts);
 
     if($res->{errors} && @{$res->{errors}}){
-        use Data::Dumper;
         die 'Application errors:'.Dumper($res->{errors});
     }
 
@@ -275,9 +281,25 @@
     return $app;
 }
 
+sub create_post {
+    my ( $class, %opts ) = @_;
+
+    my $userid = delete $opts{userid} or die "Can't create post without userid";
+
+    my $u = LJ::load_userid($userid) or die "Can't load user $userid";
+
+    return $u->t_post_fake_entry(%opts);
+}
+
+sub create_comment {
+    my ( $class, %opts ) = @_;
+
+    my $entry = delete $opts{entry};
+
+    return $entry->t_enter_comment(%opts);
+}
+
 sub get_access_token {
-    use LJ::OAuth::AccessToken;
-
     my $class = shift;
     my %opts = @_;
     $opts{access} ||= [];

Tags: livejournal, nikulochkina, nnikulochkina, pm
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments