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

[livejournal] r22175: LJSUP-12478: Tests for LJ::OAuth

Committer: nnikulochkina
LJSUP-12478: Tests for LJ::OAuth
U   trunk/cgi-bin/LJ/Test.pm
Modified: trunk/cgi-bin/LJ/Test.pm
===================================================================
--- trunk/cgi-bin/LJ/Test.pm	2012-06-05 12:16:41 UTC (rev 22174)
+++ trunk/cgi-bin/LJ/Test.pm	2012-06-05 12:36:50 UTC (rev 22175)
@@ -116,7 +116,8 @@
             $opts{'owner'} = $class->create_user(
                 %opts, 'journaltype' => 'P', 'user' => undef );
         }
-
+        $opts{'membership'} ||= 'open';
+        $opts{'postlevel'}  ||= 'members'; 
         $u = LJ::User->create_community(%opts);
     } elsif ( $journaltype eq 'Y' ) {
         unless ( defined $opts{'creator'} ) {
@@ -242,6 +243,27 @@
     die "Unable to allocate SMS number after 100 tries";
 }
 
+
+sub create_application {
+    my $class = shift;
+    my %opts = @_;
+    
+    my $prefix = "t_" || $opts{prefix};
+
+    $opts{application_key} ||= $prefix . LJ::rand_chars(8);
+    $opts{name}            ||= $opts{application_key};
+    $opts{type}            ||= 'E'; 
+
+    my $res = LJ::UserApps->add_application(%opts);
+
+    if($res->{errors} && @{$res->{errors}}){
+        use Data::Dumper;
+        die 'Application errors:'.Dumper($res->{errors});
+    }
+    
+    return $res->{application};
+}
+
 package LJ::Test::FakeMemCache;
 # duck-typing at its finest!
 # this is a fake Cache::Memcached object which implements the

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