@@ -5,13 +5,13 @@ test('Basics', function () {
5
5
6
6
test ( 'toHeaderString' , function ( ) {
7
7
var params , realm_param , realm_key , realm_val ;
8
-
8
+
9
9
params = {
10
10
realm : 'http://www.example.com' ,
11
11
consumerKey : 'consumerkey' ,
12
12
consumerSecret : 'consumersecret'
13
13
} ;
14
-
14
+
15
15
realm_param = toHeaderString ( params ) . match ( / ^ ( r e a l m ) = " ( .+ ?) " / ) ;
16
16
realm_key = realm_param [ 1 ] ;
17
17
realm_val = realm_param [ 2 ] ;
@@ -22,7 +22,7 @@ test('toHeaderString', function () {
22
22
} ) ;
23
23
24
24
test ( 'toSignatureBaseString' , function ( ) {
25
-
25
+
26
26
/**
27
27
* Generate a signature base string for the request
28
28
*
@@ -35,17 +35,17 @@ test('toSignatureBaseString', function () {
35
35
function toSignatureBaseString(method, url, header_params, query_params) {
36
36
*/
37
37
38
-
38
+
39
39
var s = toSignatureBaseString ( "GET" , "http://www.example.com" , { "h1" :"v1" , "h1-2" :"v2" } , { "q1" :"v1" , "q1-2" :"v2" } ) ;
40
-
40
+
41
41
equals ( s , "GET&http%3A%2F%2Fwww.example.com&h1%3Dv1%26h1-2%3Dv2%26q1%3Dv1%26q1-2%3Dv2" ) ;
42
42
} ) ;
43
43
44
44
45
45
test ( 'Output URL Encode' , function ( ) {
46
46
equals ( OAuth . urlEncode ( '' ) , '' , 'Output test 1' ) ;
47
- equals ( OAuth . urlEncode ( "\r\n $ & < > ? ; # : = , \" ' ~ + %" ) , '%0D%0A%20%24%20%26%20%3C%20%3E%20%3F%20%3B%20%23%20%3A%20%3D%20%2C%20%22%20%27%20~%20%2B%20%25' , 'Output test 2' ) ;
48
-
47
+ equals ( OAuth . urlEncode ( "\t\ r\n $ & < > ? ; # : = , \" ' ~ + %" ) , '%09 %0D%0A%20%24%20%26%20%3C%20%3E%20%3F%20%3B%20%23%20%3A%20%3D%20%2C%20%22%20%27%20~%20%2B%20%25' , 'Output test 2' ) ;
48
+
49
49
equals ( OAuth . urlEncode ( 'ß' ) , '%C3%9F' , 'Output test 3' ) ;
50
50
equals ( OAuth . urlEncode ( 'ü' ) , '%C3%BC' , 'Output test 4' ) ;
51
51
} ) ;
@@ -86,16 +86,16 @@ var oauth = OAuth({
86
86
enablePrivilege : false ,
87
87
consumerKey : 'ba9df9055c77f338' ,
88
88
consumerSecret : '846ffe1ec3b18989e73fe7fff833' ,
89
-
89
+
90
90
realm : 'http://oauth-sandbox.sevengoslings.net' ,
91
91
requestTokenUrl : 'http://oauth-sandbox.sevengoslings.net/request_token' ,
92
92
authorizationUrl : 'http://oauth-sandbox.sevengoslings.net/authorize' ,
93
93
accessTokenUrl : 'http://oauth-sandbox.sevengoslings.net/access_token'
94
94
} ) ;
95
-
95
+
96
96
97
97
asyncTest ( "OAuth Authorise" , function ( ) {
98
-
98
+
99
99
oauth . fetchRequestToken ( function ( url ) {
100
100
var windowObjectReference = window . open ( url , 'authorise' ) ;
101
101
@@ -106,16 +106,16 @@ asyncTest("OAuth Authorise", function() {
106
106
107
107
108
108
document . body . appendChild ( mask ) ;
109
-
109
+
110
110
var button = document . getElementById ( 'start-app-button' ) ;
111
111
button . onclick = function ( ) {
112
112
var code = document . getElementById ( 'verification' ) . value ;
113
113
oauth . setVerifier ( code ) ;
114
-
114
+
115
115
oauth . fetchAccessToken ( function ( data ) {
116
116
ok ( true ) ;
117
117
start ( ) ;
118
-
118
+
119
119
} , function ( data ) { console . log ( data ) } ) ;
120
120
} ;
121
121
} , function ( data ) { console . log ( data ) } ) ;
0 commit comments