-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathtest_source__wowi.py
90 lines (78 loc) · 2.27 KB
/
test_source__wowi.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
from __future__ import annotations
import pytest
from yarl import URL
from instawow._sources.wowi import WowiResolver
from instawow.definitions import Defn
from instawow.pkg_models import Pkg
from instawow.shared_ctx import ConfigBoundCtx
@pytest.fixture
def wowi_resolver(
iw_config_ctx: ConfigBoundCtx,
):
return WowiResolver(iw_config_ctx.config)
@pytest.mark.usefixtures('_iw_web_client_ctx')
async def test_resolve_addon(
wowi_resolver: WowiResolver,
):
defn = Defn('wowi', '13188-molinari')
result = (await wowi_resolver.resolve([defn]))[defn]
assert type(result) is Pkg
@pytest.mark.usefixtures('_iw_web_client_ctx')
async def test_changelog_url_format(
wowi_resolver: WowiResolver,
):
defn = Defn('wowi', '13188-molinari')
result = (await wowi_resolver.resolve([defn]))[defn]
assert type(result) is Pkg
assert result.changelog_url.startswith('data:,')
@pytest.mark.parametrize(
('url', 'extracted_alias'),
[
(
'https://www.wowinterface.com/downloads/landing.php?fileid=13188',
'13188',
),
(
'https://wowinterface.com/downloads/landing.php?fileid=13188',
'13188',
),
(
'https://www.wowinterface.com/downloads/fileinfo.php?id=13188',
'13188',
),
(
'https://wowinterface.com/downloads/fileinfo.php?id=13188',
'13188',
),
(
'https://www.wowinterface.com/downloads/download13188-Molinari',
'13188',
),
(
'https://wowinterface.com/downloads/download13188-Molinari',
'13188',
),
(
'https://www.wowinterface.com/downloads/info13188-Molinari.html',
'13188',
),
(
'https://wowinterface.com/downloads/info13188-Molinari.html',
'13188',
),
(
'https://www.wowinterface.com/downloads/info13188',
'13188',
),
(
'https://wowinterface.com/downloads/info13188',
'13188',
),
],
)
def test_can_extract_alias_from_url(
wowi_resolver: WowiResolver,
url: str,
extracted_alias: str,
):
assert wowi_resolver.get_alias_from_url(URL(url)) == extracted_alias