File: 05-auth.t

package info (click to toggle)
libnet-oauth-perl 0.31-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 308 kB
  • sloc: perl: 1,484; makefile: 8
file content (33 lines) | stat: -rw-r--r-- 806 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!perl

use strict;
use warnings;
use Test::More tests => 6;

BEGIN {
    use Net::OAuth;
    $Net::OAuth::PROTOCOL_VERSION = Net::OAuth::PROTOCOL_VERSION_1_0;
    use_ok( 'Net::OAuth::Request' );
    use_ok( 'Net::OAuth::Response' );
    use_ok( 'Net::OAuth::UserAuthRequest' );
    use_ok( 'Net::OAuth::UserAuthResponse' );
}

my $request = Net::OAuth::UserAuthRequest->new(
    token => 'abcdef',
    callback => 'http://example.com/callback',
    extra_params => {
            foo => 'bar',
    },
);

is($request->to_post_body, 'foo=bar&oauth_callback=http%3A%2F%2Fexample.com%2Fcallback&oauth_token=abcdef');

my $response = Net::OAuth::UserAuthResponse->new(
    token => 'abcdef',
    extra_params => {
            foo => 'bar',
    },
);

is($response->to_post_body, 'foo=bar&oauth_token=abcdef');