Updated sites, improved submit dialog, bump to 0.2.2

This commit is contained in:
Soxoj
2021-05-07 12:27:24 +03:00
parent d59867b0d9
commit b6a207d0e3
10 changed files with 3044 additions and 2907 deletions
+24 -7
View File
@@ -6,7 +6,11 @@ import pytest
from mock import Mock
from maigret.maigret import self_check, maigret
from maigret.maigret import extract_ids_from_page, extract_ids_from_results, extract_ids_from_url
from maigret.maigret import (
extract_ids_from_page,
extract_ids_from_results,
extract_ids_from_url,
)
from maigret.sites import MaigretSite
from maigret.result import QueryResult, QueryStatus
@@ -139,17 +143,27 @@ def test_maigret_results(test_db):
def test_extract_ids_from_url(default_db):
assert extract_ids_from_url('https://www.reddit.com/user/test', default_db) == {'test': 'username'}
assert extract_ids_from_url('https://www.reddit.com/user/test', default_db) == {
'test': 'username'
}
assert extract_ids_from_url('https://vk.com/id123', default_db) == {'123': 'vk_id'}
assert extract_ids_from_url('https://vk.com/ida123', default_db) == {'ida123': 'username'}
assert extract_ids_from_url('https://my.mail.ru/yandex.ru/dipres8904/', default_db) == {'dipres8904': 'username'}
assert extract_ids_from_url('https://reviews.yandex.ru/user/adbced123', default_db) == {'adbced123': 'yandex_public_id'}
assert extract_ids_from_url('https://vk.com/ida123', default_db) == {
'ida123': 'username'
}
assert extract_ids_from_url(
'https://my.mail.ru/yandex.ru/dipres8904/', default_db
) == {'dipres8904': 'username'}
assert extract_ids_from_url(
'https://reviews.yandex.ru/user/adbced123', default_db
) == {'adbced123': 'yandex_public_id'}
@pytest.mark.slow
def test_extract_ids_from_page(test_db):
logger = Mock()
extract_ids_from_page('https://www.reddit.com/user/test', logger) == {'test': 'username'}
extract_ids_from_page('https://www.reddit.com/user/test', logger) == {
'test': 'username'
}
def test_extract_ids_from_results(test_db):
@@ -157,4 +171,7 @@ def test_extract_ids_from_results(test_db):
TEST_EXAMPLE['Reddit']['ids_usernames'] = {'test1': 'yandex_public_id'}
TEST_EXAMPLE['Reddit']['ids_links'] = ['https://www.reddit.com/user/test2']
extract_ids_from_results(TEST_EXAMPLE, test_db) == {'test1': 'yandex_public_id', 'test2': 'username'}
extract_ids_from_results(TEST_EXAMPLE, test_db) == {
'test1': 'yandex_public_id',
'test2': 'username',
}