mirror of
https://github.com/soxoj/maigret.git
synced 2026-05-06 22:19:01 +00:00
Twitter parsing activation
This commit is contained in:
+13
-1
@@ -1,6 +1,11 @@
|
||||
from _pytest.mark import Mark
|
||||
from mock import Mock
|
||||
import os
|
||||
import pytest
|
||||
|
||||
from maigret.sites import MaigretDatabase, MaigretSite
|
||||
|
||||
JSON_FILE = os.path.join(os.path.dirname(os.path.realpath(__file__)), '../maigret/resources/data.json')
|
||||
empty_mark = Mark('', [], {})
|
||||
|
||||
|
||||
@@ -9,4 +14,11 @@ def by_slow_marker(item):
|
||||
|
||||
|
||||
def pytest_collection_modifyitems(items):
|
||||
items.sort(key=by_slow_marker, reverse=False)
|
||||
items.sort(key=by_slow_marker, reverse=False)
|
||||
|
||||
|
||||
@pytest.fixture(scope='session')
|
||||
def default_db():
|
||||
db = MaigretDatabase().load_from_file(JSON_FILE)
|
||||
|
||||
return db
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
"""Maigret activation test functions"""
|
||||
from mock import Mock
|
||||
import pytest
|
||||
|
||||
from maigret.activation import ParsingActivator
|
||||
|
||||
|
||||
@pytest.mark.slow
|
||||
def test_twitter_activation(default_db):
|
||||
twitter_site = default_db.sites_dict['Twitter']
|
||||
token1 = twitter_site.headers['x-guest-token']
|
||||
|
||||
ParsingActivator.twitter(twitter_site, Mock())
|
||||
token2 = twitter_site.headers['x-guest-token']
|
||||
|
||||
assert token1 != token2
|
||||
Reference in New Issue
Block a user