Skip to content

Commit 4ea2e61

Browse files
committed
增加 帐号密码验证 测试
1 parent 3b41773 commit 4ea2e61

File tree

2 files changed

+30
-7
lines changed

2 files changed

+30
-7
lines changed

config.coffee

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
yaml = require 'js-yaml'
2+
fs = require 'fs'
3+
config = fs.readFileSync './config.yaml' , 'utf8'
4+
module.exports = yaml.load config

tests/main.coffee

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@ api = require("../src/qqapi")
77

88
log "testing..."
99

10-
11-
10+
config = require '../config'
11+
qq = config.account
12+
pass = config.password
1213

1314

1415
test_check_qq = ->
@@ -19,10 +20,28 @@ test_check_qq = ->
1920

2021

2122
test_encode_password = ->
22-
log api.encode_password("123","!GZH",'\\x00\\x00\\x00\\x00\\x07\\x60\\xa4\\x78')
23+
log api.encode_password(pass,"!PYL",'\\x00\\x00\\x00\\x00\\x07\\x60\\xa4\\x78')
24+
# should equal to 7BB648B45C561A5F986DECCD94644A3E
25+
26+
test_login_full = ->
27+
28+
log "验证帐号"
29+
api.check_qq qq , (result) ->
30+
log "验证帐号:", result
31+
is_need_verify_code = int result[0]
32+
if is_need_verify_code
33+
log "需要验证码 bye"
34+
return
35+
36+
new_pass = api.encode_password(pass,result[1],result[2])
37+
log "生成加密密码" , new_pass
38+
39+
40+
log "开始登录"
41+
api.login qq, new_pass , result[1], '', (ret)->
42+
log '登录结果'
43+
log ret
2344

2445
# test_check_qq()
25-
test_encode_password()
26-
27-
28-
46+
# test_encode_password()
47+
test_login_full()

0 commit comments

Comments
 (0)