-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathAuthTest.scala
More file actions
32 lines (27 loc) · 891 Bytes
/
AuthTest.scala
File metadata and controls
32 lines (27 loc) · 891 Bytes
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
package com.douban.models
import java.awt.Desktop
import java.net.URI
import com.douban.common._
/**
* Copyright by <a href="http://www.josephjctang.com"><em><i>Joseph J.C. Tang</i></em></a> <br/>
* Email: <a href="mailto:jinntrance@gmail.com">jinntrance@gmail.com</a>
* @author joseph
* @since 12/26/12 10:37 PM
* @version 1.0
*/
class AuthTest extends BaseTest {
test("the auth url") {
val url=new URI(Auth.getAuthUrl(Auth.api_key, Auth.redirect_url))
println(url)
Desktop.getDesktop.browse(url)
// val codeUrl = readLine("please copy the url here after authorization>\n")
// Auth.code = Auth.extractCode(codeUrl)
}
test("the acess token url") {
prettyJSON(Auth.getTokenByCode("3f5bd2951eb79e98", api_key, secret))
}
test("the refresh token url") {
val t = Auth.getTokenByFresh(refresh_token, api_key, secret)
prettyJSON(t)
}
}