mirror of
https://github.com/bellingcat/tiktok-hashtag-analysis.git
synced 2026-06-12 05:18:30 +03:00
added tests, changed __main__ to cli
This commit is contained in:
24
tests/auth.py
Normal file
24
tests/auth.py
Normal file
@@ -0,0 +1,24 @@
|
||||
import pytest
|
||||
|
||||
from tiktok_hashtag_analysis.auth import Authorization
|
||||
|
||||
MS_TOKEN = "thisisafakemstokenfortiktok"
|
||||
|
||||
|
||||
def test_auth_input(tmp_path, monkeypatch):
|
||||
config_file = tmp_path / ".tiktok"
|
||||
monkeypatch.setattr("builtins.input", lambda _: MS_TOKEN)
|
||||
auth = Authorization(config_file=config_file)
|
||||
auth.get_token()
|
||||
|
||||
assert auth.ms_token == MS_TOKEN
|
||||
|
||||
|
||||
def test_auth(tmp_path):
|
||||
config_file = tmp_path / ".tiktok"
|
||||
auth = Authorization(config_file=config_file)
|
||||
|
||||
auth.dump_token(ms_token=MS_TOKEN)
|
||||
auth.get_token()
|
||||
|
||||
assert auth.ms_token == MS_TOKEN
|
||||
Reference in New Issue
Block a user