Skip to content

Commit

Permalink
improve: Add tests for ignored weibo.
Browse files Browse the repository at this point in the history
  • Loading branch information
hguandl committed Apr 9, 2021
1 parent d779449 commit 33193fd
Show file tree
Hide file tree
Showing 4 changed files with 573 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
### Testing files ###
config_test.yaml
testdir/

### Compile output ###
build/
Expand Down
6 changes: 4 additions & 2 deletions cmd/fake-server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@ import (
"net/http"
)

var weiboTests = [4]string{
var weiboTests = [6]string{
"tests/weibo/01-mblog-with-article.json",
"tests/weibo/02-mblog-with-video.json",
"tests/weibo/03-mblog-with-text.json",
"tests/weibo/04-mblog-with-tag-and-pic.json",
"tests/weibo/05-retweeted.json",
"tests/weibo/06-lottery.json",
}
var weiboIdx = 0

Expand All @@ -34,7 +36,7 @@ var sirenIdx = 0
func weiboHandler(w http.ResponseWriter, r *http.Request) {
data, _ := ioutil.ReadFile(weiboTests[weiboIdx])
log.Printf("Deliverd %v\n", weiboTests[weiboIdx])
weiboIdx = (weiboIdx + 1) % 4
weiboIdx = (weiboIdx + 1) % 6
w.Write(data)
}

Expand Down
214 changes: 214 additions & 0 deletions tests/weibo/05-retweeted.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,214 @@
{
"data": {
"cards": [
{
"card_type": 9,
"mblog": {
"visible": {
"type": 0,
"list_id": 0
},
"created_at": "Mon Apr 08 16:24:02 +0800 2077",
"id": "4612511255495518",
"mid": "4612511255495518",
"can_edit": false,
"show_additional_indication": 0,
"text": "\u611f\u8c22\u5927\u5bb6\u7684\u5173\u6ce8\u4e0e\u652f\u6301",
"source": "\u5fae\u535a weibo.com",
"favorited": false,
"pic_ids": [],
"pic_types": "",
"is_paid": false,
"mblog_vip_type": 0,
"user": {
"id": 6279793937,
"screen_name": "\u660e\u65e5\u65b9\u821fArknights",
"profile_image_url": "https://tvax4.sinaimg.cn/crop.0.0.756.756.180/006QZngZly8gdj05mufr9j30l00l0dq4.jpg?KID=imgbed,tva&Expires=1616523643&ssig=a3IdHB%2F6vH",
"profile_url": "https://m.weibo.cn/u/6279793937?uid=6279793937&luicode=10000011&lfid=1076036279793937",
"statuses_count": 1093,
"verified": true,
"verified_type": 2,
"verified_type_ext": 50,
"verified_reason": "\u4e0a\u6d77\u9e70\u89d2\u7f51\u7edc\u79d1\u6280\u6709\u9650\u516c\u53f8",
"close_blue_v": false,
"description": "\u300a\u660e\u65e5\u65b9\u821f\u300b\u5b98\u65b9\u5fae\u535a\uff0c\u6b22\u8fce\u54a8\u8be2\u5ba2\u670dQQ\u670d\u52a1\u53f7\uff1a800830064",
"gender": "f",
"mbtype": 12,
"urank": 4,
"mbrank": 6,
"follow_me": false,
"following": false,
"followers_count": 1255974,
"follow_count": 32,
"cover_image_phone": "https://wx4.sinaimg.cn/crop.0.0.640.640.640/006QZngZgy1gdidkac88qj30u00u0k0a.jpg",
"avatar_hd": "https://wx4.sinaimg.cn/orj480/006QZngZly8gdj05mufr9j30l00l0dq4.jpg",
"like": false,
"like_me": false,
"badge": {
"user_name_certificate": 1
}
},
"retweeted_status": {
"visible": {
"type": 0,
"list_id": 0
},
"created_at": "Mon Mar 08 16:04:51 +0800 2021",
"id": "4612506428116129",
"mid": "4612506428116129",
"can_edit": false,
"show_additional_indication": 0,
"text": "<a href=\"https://m.weibo.cn/search?containerid=231522type%3D1%26t%3D10%26q%3D%23%E6%98%8E%E6%97%A5%E6%96%B9%E8%88%9F%23&isnewpage=1&luicode=10000011&lfid=1076036279793937\" data-hide=\"\"><span class=\"surl-text\">#\u660e\u65e5\u65b9\u821f#</span></a> <a href=\"https://m.weibo.cn/search?containerid=231522type%3D1%26t%3D10%26q%3D%23%E6%9C%9D%E9%99%87%E5%B1%B1%23&extparam=%23%E6%9C%9D%E9%99%87%E5%B1%B1%23&luicode=10000011&lfid=1076036279793937\" data-hide=\"\"><span class=\"surl-text\">#\u671d\u9647\u5c71#</span></a> <br />[\u671d\u9647\u5c71\u5154\uff1a\u63d0\u8d77\u5587\u53ed]\u6709\u4e2a\u6700\u65b0\u6d88\u606f\u7ec8\u4e8e\u53ef\u4ee5\u516c\u5e03\u5566\uff01<br /> <br />\u300a\u660e\u65e5\u65b9\u821f\u5b98\u65b9\u7f8e\u672f\u8bbe\u5b9a\u96c6Vol.1\u300b\u2014\u2014\u660e\u65e5\u65b9\u821f\u65d7\u8230\u5e97\u72ec\u5bb6\u53d1\u552e\u5373\u5c06\u5f00\u59cb\uff01<br />\u89c4\u683c\uff1a16\u5927\u5f00\u5c3a\u5bf8 / 416P<br /> <br />\u5185\u542b\u65f6\u88c5\u5151\u6362\u5361*1<br />\u53ef\u5151\u6362\u9650\u5b9a\u65f6\u88c5\uff1a\u64ad\u79cd\u8005-\u963f\u7c73\u5a05 <br />\u9884\u8ba1\u9884\u552e\u65f6\u95f4\uff1a3\u6708\u672b4\u6708\u521d<br />\u9884\u8ba1\u53d1\u8d27\uff1a5\u6708~6\u6708 ",
"textLength": 256,
"source": "\u5fae\u535a weibo.com",
"favorited": false,
"pic_ids": [
"0071VPLMgy1gock5i5oajj31b00u0az7",
"0071VPLMgy1gock5i6j7dj31b00u0noa"
],
"pic_types": "",
"thumbnail_pic": "https://wx2.sinaimg.cn/thumbnail/0071VPLMgy1gock5i5oajj31b00u0az7.jpg",
"bmiddle_pic": "http://wx2.sinaimg.cn/bmiddle/0071VPLMgy1gock5i5oajj31b00u0az7.jpg",
"original_pic": "https://wx2.sinaimg.cn/large/0071VPLMgy1gock5i5oajj31b00u0az7.jpg",
"is_paid": false,
"mblog_vip_type": 0,
"user": {
"id": 6441489862,
"screen_name": "\u660e\u65e5\u65b9\u821f\u671d\u9647\u5c71",
"profile_image_url": "https://tvax4.sinaimg.cn/crop.0.0.708.708.180/0071VPLMly8ge6elzmg36j30jo0jogrv.jpg?KID=imgbed,tva&Expires=1616523643&ssig=jyauYrcidI",
"profile_url": "https://m.weibo.cn/u/6441489862?uid=6441489862&luicode=10000011&lfid=1076036279793937",
"statuses_count": 659,
"verified": true,
"verified_type": 0,
"verified_type_ext": 0,
"verified_reason": "\u4e0a\u6d77\u9e70\u89d2\u7f51\u7edc\u79d1\u6280\u6709\u9650\u516c\u53f8 \u5468\u8fb9\u7f16\u8f91",
"close_blue_v": false,
"description": "@\u660e\u65e5\u65b9\u821fArknights \u660e\u65e5\u65b9\u821f\u5b98\u65b9\u5468\u8fb9\u76f8\u5173 | \u5546\u54c1\u552e\u540e\u53ca\u66f4\u591a\u5efa\u8bae\u8bf7\u8054\u7cfb\u90ae\u7bb1cs@hypergryph.com",
"gender": "f",
"mbtype": 12,
"urank": 4,
"mbrank": 6,
"follow_me": false,
"following": false,
"followers_count": 269877,
"follow_count": 64,
"cover_image_phone": "https://wx3.sinaimg.cn/crop.0.0.640.640.640/0071VPLMgy1gdidjyz70mj30u00u0wpu.jpg",
"avatar_hd": "https://wx4.sinaimg.cn/orj480/0071VPLMly8ge6elzmg36j30jo0jogrv.jpg",
"like": false,
"like_me": false,
"badge": {
"user_name_certificate": 1,
"hongrenjie_2019": 1
}
},
"picStatus": "1",
"reposts_count": 6927,
"comments_count": 1833,
"attitudes_count": 39307,
"pending_approval_count": 0,
"isLongText": false,
"reward_exhibition_type": 0,
"hide_flag": 0,
"mlevel": 0,
"darwin_tags": [],
"mblogtype": 0,
"rid": "1_0_50_2606565349288026145_0_0_0",
"more_info_type": 0,
"number_display_strategy": {
"apply_scenario_flag": 3,
"display_text_min_number": 1000000,
"display_text": "100\u4e07+"
},
"content_auth": 0,
"pic_num": 2,
"edit_config": {
"edited": false
},
"page_info": {
"type": "search_topic",
"object_type": 0,
"page_pic": {
"url": "https://wx4.sinaimg.cn/large/006QZngZly1gebqvb31dcj30dw0dwgn4.jpg"
},
"page_url": "https://m.weibo.cn/search?containerid=231522type%3D1%26t%3D10%26q%3D%23%E6%98%8E%E6%97%A5%E6%96%B9%E8%88%9F%23&isnewpage=1&luicode=10000011&lfid=1076036279793937",
"page_title": "#\u660e\u65e5\u65b9\u821f#",
"content1": "0\u8ba8\u8bba 0\u9605\u8bfb "
},
"pics": [
{
"pid": "0071VPLMgy1gock5i5oajj31b00u0az7",
"url": "https://wx2.sinaimg.cn/orj360/0071VPLMgy1gock5i5oajj31b00u0az7.jpg",
"size": "orj360",
"geo": {
"width": 423,
"height": 270,
"croped": false
},
"large": {
"size": "large",
"url": "https://wx2.sinaimg.cn/large/0071VPLMgy1gock5i5oajj31b00u0az7.jpg",
"geo": {
"width": "1692",
"height": "1080",
"croped": false
}
}
},
{
"pid": "0071VPLMgy1gock5i6j7dj31b00u0noa",
"url": "https://wx4.sinaimg.cn/orj360/0071VPLMgy1gock5i6j7dj31b00u0noa.jpg",
"size": "orj360",
"geo": {
"width": 423,
"height": 270,
"croped": false
},
"large": {
"size": "large",
"url": "https://wx4.sinaimg.cn/large/0071VPLMgy1gock5i6j7dj31b00u0noa.jpg",
"geo": {
"width": "1692",
"height": "1080",
"croped": false
}
}
}
],
"bid": "K5flEy3nj"
},
"reposts_count": 1272,
"comments_count": 521,
"attitudes_count": 16133,
"pending_approval_count": 0,
"isLongText": false,
"reward_exhibition_type": 0,
"hide_flag": 0,
"mlevel": 0,
"darwin_tags": [],
"mblogtype": 0,
"rid": "1_0_50_2606565349288026145_0_0_0",
"more_info_type": 0,
"extern_safe": 0,
"number_display_strategy": {
"apply_scenario_flag": 3,
"display_text_min_number": 1000000,
"display_text": "100\u4e07+"
},
"enable_comment_guide": true,
"content_auth": 0,
"repost_type": 1,
"pic_num": 0,
"alchemy_params": {
"ug_red_envelope": false
},
"mblog_menu_new_style": 0,
"edit_config": {
"edited": false
},
"raw_text": "\u611f\u8c22\u5927\u5bb6\u7684\u5173\u6ce8\u4e0e\u652f\u6301",
"bid": "K5ftrn3Do"
}
}
]
}
}
Loading

0 comments on commit 33193fd

Please sign in to comment.