added tests, changed __main__ to cli

This commit is contained in:
Tristan Lee
2023-09-04 13:26:38 -05:00
parent 0f8e865bf3
commit 5ae9624968
11 changed files with 101 additions and 3 deletions

24
tests/auth.py Normal file
View 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