Skip to content

Commit

Permalink
test(trends): ✅ add tests for trends
Browse files Browse the repository at this point in the history
  • Loading branch information
MerleLiuKun committed Mar 18, 2024
1 parent fb2ffa4 commit 5c031ec
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions testdata/apis/trends/trends_resp.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"data":[{"trend_name":"#TEZOSTUESDAY","tweet_count":14869},{"trend_name":"Copenhagen","tweet_count":13005},{"trend_name":"Roses","tweet_count":32193},{"trend_name":"Heroes","tweet_count":69798},{"trend_name":"Cedric","tweet_count":14259},{"trend_name":"#AskSonic","tweet_count":8908},{"trend_name":"Nelson","tweet_count":29841},{"trend_name":"#PSVARS","tweet_count":4915},{"trend_name":"Eddie","tweet_count":34139},{"trend_name":"Saliba","tweet_count":7191},{"trend_name":"Walters","tweet_count":8095},{"trend_name":"Bakayoko","tweet_count":1809},{"trend_name":"Bibby Stockholm","tweet_count":21021},{"trend_name":"Nwaneri","tweet_count":5783},{"trend_name":"Doncaster","tweet_count":3551},{"trend_name":"Kiwior","tweet_count":1535}]}
17 changes: 17 additions & 0 deletions tests/apis/test_trends.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
"""
tests for the trends api
"""

import responses


@responses.activate
def test_get_trends_by_woeid(api, helpers):
responses.add(
responses.GET,
url="https://api.twitter.com/2/trends/by/woeid/1",
json=helpers.load_json_data("testdata/apis/trends/trends_resp.json"),
)

resp = api.get_trends_by_woeid(1)
assert resp.data[0].trend_name == "#TEZOSTUESDAY"

0 comments on commit 5c031ec

Please sign in to comment.