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

[livejournal] r22210: LJSUP-12519: Tests for LJ::Protocol

Committer: nnikulochkina
LJSUP-12519: Tests for LJ::Protocol
U   trunk/cgi-bin/LJ/Test.pm
Modified: trunk/cgi-bin/LJ/Test.pm
===================================================================
--- trunk/cgi-bin/LJ/Test.pm	2012-06-08 09:49:40 UTC (rev 22209)
+++ trunk/cgi-bin/LJ/Test.pm	2012-06-08 10:37:54 UTC (rev 22210)
@@ -270,11 +270,26 @@
     $app->set_primary($opts{primary}) if $opts{primary};
     $app->set_secondary($opts{secondary}) if $opts{secondary};
     
-    $app->{non} = [@{$LJ::USERAPPS_ACCESS_LISTS}[6..$#$LJ::USERAPPS_ACCESS_LISTS]];
+    $app->{non} = $opts{non} || [@{$LJ::USERAPPS_ACCESS_LISTS}[6..$#$LJ::USERAPPS_ACCESS_LISTS]];
 
     return $app;
 }
 
+sub get_access_token {
+    use LJ::OAuth::AccessToken;
+
+    my $class = shift;
+    my %opts = @_;
+    $opts{access} ||= [];
+    my $app = $opts{app} or die "Application is not specified";
+    $app->authorize( userid => $opts{userid}, access => $opts{access} );
+    my $token =  LJ::OAuth::AccessToken->generate(
+                                                  consumer_key => $opts{consumer_key},
+                                                  userid       => $opts{userid},
+                                                  );
+    return $token;
+}
+
 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