Committer: nnikulochkina
LJSUP-12478: Tests for LJ::OAuthU trunk/cgi-bin/LJ/Test.pm
Modified: trunk/cgi-bin/LJ/Test.pm =================================================================== --- trunk/cgi-bin/LJ/Test.pm 2012-06-06 08:19:27 UTC (rev 22177) +++ trunk/cgi-bin/LJ/Test.pm 2012-06-06 10:49:32 UTC (rev 22178) @@ -253,6 +253,9 @@ $opts{application_key} ||= $prefix . LJ::rand_chars(8); $opts{name} ||= $opts{application_key}; $opts{type} ||= 'E'; + $opts{status} ||= 'A'; + $opts{primary} ||= [@{$LJ::USERAPPS_ACCESS_LISTS}[0..2]]; + $opts{secondary} ||= [@{$LJ::USERAPPS_ACCESS_LISTS}[3..5]]; my $res = LJ::UserApps->add_application(%opts); @@ -260,8 +263,16 @@ use Data::Dumper; die 'Application errors:'.Dumper($res->{errors}); } + + my $app = $res->{application}; + + $app->set_status($opts{status}) unless $opts{status} eq 'R'; + $app->set_primary($opts{primary}) if $opts{primary}; + $app->set_secondary($opts{secondary}) if $opts{secondary}; - return $res->{application}; + $app->{non} = [@{$LJ::USERAPPS_ACCESS_LISTS}[6..$#$LJ::USERAPPS_ACCESS_LISTS]]; + + return $app; } package LJ::Test::FakeMemCache;