akef 0.3.0__tar.gz → 1.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {akef-0.3.0 → akef-1.0.0}/PKG-INFO +5 -4
- {akef-0.3.0 → akef-1.0.0}/README.md +2 -1
- {akef-0.3.0 → akef-1.0.0}/akef/__init__.py +1 -1
- {akef-0.3.0 → akef-1.0.0}/akef/cache.py +0 -2
- {akef-0.3.0 → akef-1.0.0}/akef/client.py +17 -32
- {akef-0.3.0 → akef-1.0.0}/akef/enka/build.py +0 -2
- {akef-0.3.0 → akef-1.0.0}/akef/enka/client.py +0 -2
- {akef-0.3.0 → akef-1.0.0}/akef/enka/gamedata.py +0 -2
- {akef-0.3.0 → akef-1.0.0}/akef/enka/player.py +0 -2
- {akef-0.3.0 → akef-1.0.0}/akef/enka/profile.py +0 -2
- {akef-0.3.0 → akef-1.0.0}/akef/enka/skport.py +0 -2
- {akef-0.3.0 → akef-1.0.0}/akef/enka/stats.py +0 -2
- {akef-0.3.0 → akef-1.0.0}/akef/errors.py +0 -2
- {akef-0.3.0 → akef-1.0.0}/akef/models/account.py +0 -2
- {akef-0.3.0 → akef-1.0.0}/akef/models/base.py +0 -2
- {akef-0.3.0 → akef-1.0.0}/akef/models/card.py +0 -2
- {akef-0.3.0 → akef-1.0.0}/akef/models/game.py +0 -2
- {akef-0.3.0 → akef-1.0.0}/akef/signing.py +0 -2
- {akef-0.3.0 → akef-1.0.0}/akef/wiki.py +0 -2
- {akef-0.3.0 → akef-1.0.0}/akef.egg-info/PKG-INFO +5 -4
- {akef-0.3.0 → akef-1.0.0}/pyproject.toml +3 -3
- {akef-0.3.0 → akef-1.0.0}/tests/test_client.py +22 -22
- {akef-0.3.0 → akef-1.0.0}/tests/test_enka.py +12 -12
- {akef-0.3.0 → akef-1.0.0}/tests/test_models.py +6 -6
- {akef-0.3.0 → akef-1.0.0}/tests/test_signing.py +2 -2
- {akef-0.3.0 → akef-1.0.0}/LICENSE +0 -0
- {akef-0.3.0 → akef-1.0.0}/akef/constants.py +0 -0
- {akef-0.3.0 → akef-1.0.0}/akef/enka/__init__.py +0 -0
- {akef-0.3.0 → akef-1.0.0}/akef/models/__init__.py +0 -0
- {akef-0.3.0 → akef-1.0.0}/akef/models/extra.py +0 -0
- {akef-0.3.0 → akef-1.0.0}/akef/models/pulls.py +0 -0
- {akef-0.3.0 → akef-1.0.0}/akef/py.typed +0 -0
- {akef-0.3.0 → akef-1.0.0}/akef.egg-info/SOURCES.txt +0 -0
- {akef-0.3.0 → akef-1.0.0}/akef.egg-info/dependency_links.txt +0 -0
- {akef-0.3.0 → akef-1.0.0}/akef.egg-info/requires.txt +0 -0
- {akef-0.3.0 → akef-1.0.0}/akef.egg-info/top_level.txt +0 -0
- {akef-0.3.0 → akef-1.0.0}/setup.cfg +0 -0
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: akef
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 1.0.0
|
|
4
4
|
Summary: Async Python wrapper for Arknights: Endfield, SKPORT accounts, Enka profiles and final stats
|
|
5
5
|
Author-email: SORA <shresthvaibhav13@gmail.com>
|
|
6
6
|
License-Expression: MIT
|
|
7
7
|
Project-URL: Homepage, https://github.com/ShresthVaibhav/akef
|
|
8
|
-
Project-URL: Documentation, https://github.
|
|
8
|
+
Project-URL: Documentation, https://shresthvaibhav.github.io/akef/
|
|
9
9
|
Project-URL: Issues, https://github.com/ShresthVaibhav/akef/issues
|
|
10
10
|
Keywords: arknights,endfield,skport,enka,gryphline,api,async
|
|
11
|
-
Classifier: Development Status ::
|
|
11
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
12
12
|
Classifier: Framework :: AsyncIO
|
|
13
13
|
Classifier: Intended Audience :: Developers
|
|
14
14
|
Classifier: Operating System :: OS Independent
|
|
@@ -41,7 +41,8 @@ on the in-game stat screen for any operator.
|
|
|
41
41
|
pip install akef
|
|
42
42
|
```
|
|
43
43
|
|
|
44
|
-
Python 3.10+. Full docs
|
|
44
|
+
Python 3.10+. Full docs on the [docs site](https://shresthvaibhav.github.io/akef/) (also in
|
|
45
|
+
[`docs/`](https://github.com/ShresthVaibhav/akef/blob/main/docs/README.md)), a script for every feature in
|
|
45
46
|
[`examples/`](https://github.com/ShresthVaibhav/akef/tree/main/examples).
|
|
46
47
|
|
|
47
48
|
## Usage
|
|
@@ -10,7 +10,8 @@ on the in-game stat screen for any operator.
|
|
|
10
10
|
pip install akef
|
|
11
11
|
```
|
|
12
12
|
|
|
13
|
-
Python 3.10+. Full docs
|
|
13
|
+
Python 3.10+. Full docs on the [docs site](https://shresthvaibhav.github.io/akef/) (also in
|
|
14
|
+
[`docs/`](https://github.com/ShresthVaibhav/akef/blob/main/docs/README.md)), a script for every feature in
|
|
14
15
|
[`examples/`](https://github.com/ShresthVaibhav/akef/tree/main/examples).
|
|
15
16
|
|
|
16
17
|
## Usage
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
from __future__ import annotations
|
|
2
|
-
|
|
3
1
|
import asyncio
|
|
4
2
|
import difflib
|
|
5
3
|
import hashlib
|
|
@@ -39,9 +37,8 @@ from akef.models import (
|
|
|
39
37
|
)
|
|
40
38
|
from akef.signing import sign
|
|
41
39
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
LOGIN_GONE = 10001
|
|
40
|
+
# skport sends 10001 for both a dead login and "already checked in"
|
|
41
|
+
LOGIN_GONE = ALREADY_CHECKED_IN = 10001
|
|
45
42
|
ATTENDANCE = "/web/v1/game/endfield/attendance"
|
|
46
43
|
CACHE_FOR = {
|
|
47
44
|
"/api/v1/game/endfield/card/detail": 60,
|
|
@@ -68,6 +65,10 @@ def _key(name: str) -> str:
|
|
|
68
65
|
return re.sub(r"[\W_]+", "", name.casefold())
|
|
69
66
|
|
|
70
67
|
|
|
68
|
+
def _dump(payload: dict) -> str:
|
|
69
|
+
return json.dumps(payload, separators=(",", ":"))
|
|
70
|
+
|
|
71
|
+
|
|
71
72
|
def _json(text: str) -> dict:
|
|
72
73
|
try:
|
|
73
74
|
data = json.loads(text) if text else {}
|
|
@@ -180,7 +181,7 @@ class Client:
|
|
|
180
181
|
headers = self._headers(account=True)
|
|
181
182
|
body = None
|
|
182
183
|
if payload is not None:
|
|
183
|
-
body =
|
|
184
|
+
body = _dump(payload)
|
|
184
185
|
headers["Content-Type"] = "application/json"
|
|
185
186
|
url = c.ACCOUNT_HOST + path + (f"?{urlencode(params)}" if params else "")
|
|
186
187
|
status, text = await self._send(method, url, headers, body)
|
|
@@ -204,7 +205,7 @@ class Client:
|
|
|
204
205
|
await self.login()
|
|
205
206
|
|
|
206
207
|
query = urlencode(params) if params else ""
|
|
207
|
-
body =
|
|
208
|
+
body = _dump(payload) if payload is not None else None
|
|
208
209
|
headers = self._headers()
|
|
209
210
|
if body is not None:
|
|
210
211
|
headers["Content-Type"] = "application/json"
|
|
@@ -295,14 +296,12 @@ class Client:
|
|
|
295
296
|
raise NoRoleError(f"UID {uid} isn't bound to this SKPORT login")
|
|
296
297
|
return found
|
|
297
298
|
|
|
298
|
-
async def
|
|
299
|
+
async def _game(self, path: str, uid: int | str | None) -> Any:
|
|
299
300
|
role = await self.role(uid)
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
role=role,
|
|
305
|
-
)
|
|
301
|
+
return await self._zonai("GET", path, params={"roleId": role.uid, "serverId": role.server_id}, role=role)
|
|
302
|
+
|
|
303
|
+
async def card(self, uid: int | str | None = None, *, raw: bool = False) -> Card | dict:
|
|
304
|
+
data = await self._game("/api/v1/game/endfield/card/detail", uid)
|
|
306
305
|
return data if raw else Card.model_validate(data["detail"])
|
|
307
306
|
|
|
308
307
|
async def character(
|
|
@@ -352,23 +351,11 @@ class Client:
|
|
|
352
351
|
raise UnknownCharacter(f"no operator called {who!r} on UID {role.uid}{hint}")
|
|
353
352
|
|
|
354
353
|
async def monument(self, uid: int | str | None = None, *, raw: bool = False) -> IndieHard | dict:
|
|
355
|
-
|
|
356
|
-
data = await self._zonai(
|
|
357
|
-
"GET",
|
|
358
|
-
"/api/v1/game/endfield/card/indie-hard",
|
|
359
|
-
params={"roleId": role.uid, "serverId": role.server_id},
|
|
360
|
-
role=role,
|
|
361
|
-
)
|
|
354
|
+
data = await self._game("/api/v1/game/endfield/card/indie-hard", uid)
|
|
362
355
|
return data if raw else IndieHard.model_validate(data["indieHard"])
|
|
363
356
|
|
|
364
357
|
async def contract(self, uid: int | str | None = None, *, raw: bool = False) -> ContractDetail | dict:
|
|
365
|
-
|
|
366
|
-
data = await self._zonai(
|
|
367
|
-
"GET",
|
|
368
|
-
"/api/v1/game/endfield/card/crisis-contract",
|
|
369
|
-
params={"roleId": role.uid, "serverId": role.server_id},
|
|
370
|
-
role=role,
|
|
371
|
-
)
|
|
358
|
+
data = await self._game("/api/v1/game/endfield/card/crisis-contract", uid)
|
|
372
359
|
return data if raw else ContractDetail.model_validate(data["crisisContract"])
|
|
373
360
|
|
|
374
361
|
async def _gacha_token(self, role: Role) -> str:
|
|
@@ -396,7 +383,7 @@ class Client:
|
|
|
396
383
|
headers = {"User-Agent": c.USER_AGENT}
|
|
397
384
|
body = None
|
|
398
385
|
if payload is not None:
|
|
399
|
-
body =
|
|
386
|
+
body = _dump(payload)
|
|
400
387
|
headers["Content-Type"] = "application/json"
|
|
401
388
|
status, text = await self._send(method, url + (f"?{urlencode(params)}" if params else ""), headers, body)
|
|
402
389
|
data = _json(text)
|
|
@@ -507,9 +494,7 @@ class Client:
|
|
|
507
494
|
|
|
508
495
|
async def inventory(self, uid: int | str | None = None, *, names: bool = True, raw: bool = False) -> Inventory | dict:
|
|
509
496
|
role = await self.role(uid)
|
|
510
|
-
data = await self.
|
|
511
|
-
params={"roleId": role.uid, "serverId": role.server_id}, role=role)
|
|
512
|
-
data = data.get("userGameData") or {}
|
|
497
|
+
data = (await self._game("/web/v1/game/endfield/team/user-game-data", role.uid)).get("userGameData") or {}
|
|
513
498
|
if raw:
|
|
514
499
|
return data
|
|
515
500
|
known: dict[str, str] = {}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: akef
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 1.0.0
|
|
4
4
|
Summary: Async Python wrapper for Arknights: Endfield, SKPORT accounts, Enka profiles and final stats
|
|
5
5
|
Author-email: SORA <shresthvaibhav13@gmail.com>
|
|
6
6
|
License-Expression: MIT
|
|
7
7
|
Project-URL: Homepage, https://github.com/ShresthVaibhav/akef
|
|
8
|
-
Project-URL: Documentation, https://github.
|
|
8
|
+
Project-URL: Documentation, https://shresthvaibhav.github.io/akef/
|
|
9
9
|
Project-URL: Issues, https://github.com/ShresthVaibhav/akef/issues
|
|
10
10
|
Keywords: arknights,endfield,skport,enka,gryphline,api,async
|
|
11
|
-
Classifier: Development Status ::
|
|
11
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
12
12
|
Classifier: Framework :: AsyncIO
|
|
13
13
|
Classifier: Intended Audience :: Developers
|
|
14
14
|
Classifier: Operating System :: OS Independent
|
|
@@ -41,7 +41,8 @@ on the in-game stat screen for any operator.
|
|
|
41
41
|
pip install akef
|
|
42
42
|
```
|
|
43
43
|
|
|
44
|
-
Python 3.10+. Full docs
|
|
44
|
+
Python 3.10+. Full docs on the [docs site](https://shresthvaibhav.github.io/akef/) (also in
|
|
45
|
+
[`docs/`](https://github.com/ShresthVaibhav/akef/blob/main/docs/README.md)), a script for every feature in
|
|
45
46
|
[`examples/`](https://github.com/ShresthVaibhav/akef/tree/main/examples).
|
|
46
47
|
|
|
47
48
|
## Usage
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "akef"
|
|
7
|
-
version = "0.
|
|
7
|
+
version = "1.0.0"
|
|
8
8
|
description = "Async Python wrapper for Arknights: Endfield, SKPORT accounts, Enka profiles and final stats"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
license = "MIT"
|
|
@@ -14,7 +14,7 @@ requires-python = ">=3.10"
|
|
|
14
14
|
dependencies = ["aiohttp>=3.9", "pydantic>=2.5"]
|
|
15
15
|
keywords = ["arknights", "endfield", "skport", "enka", "gryphline", "api", "async"]
|
|
16
16
|
classifiers = [
|
|
17
|
-
"Development Status ::
|
|
17
|
+
"Development Status :: 5 - Production/Stable",
|
|
18
18
|
"Framework :: AsyncIO",
|
|
19
19
|
"Intended Audience :: Developers",
|
|
20
20
|
"Operating System :: OS Independent",
|
|
@@ -29,7 +29,7 @@ classifiers = [
|
|
|
29
29
|
|
|
30
30
|
[project.urls]
|
|
31
31
|
Homepage = "https://github.com/ShresthVaibhav/akef"
|
|
32
|
-
Documentation = "https://github.
|
|
32
|
+
Documentation = "https://shresthvaibhav.github.io/akef/"
|
|
33
33
|
Issues = "https://github.com/ShresthVaibhav/akef/issues"
|
|
34
34
|
|
|
35
35
|
[project.optional-dependencies]
|
|
@@ -3,7 +3,7 @@ import pytest
|
|
|
3
3
|
from akef import AlreadyCheckedIn, APIError, AuthError, NoRoleError, UnknownCharacter
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
async def
|
|
6
|
+
async def test_check_in_twice(client):
|
|
7
7
|
result = await client.check_in()
|
|
8
8
|
assert [r.name for r in result.rewards] == ["Oroberyl", "Intermediate Combat Record"]
|
|
9
9
|
assert result.rewards[0].count == 90
|
|
@@ -28,14 +28,14 @@ async def test_login_flow(client):
|
|
|
28
28
|
assert len(paths) == 2
|
|
29
29
|
|
|
30
30
|
|
|
31
|
-
async def
|
|
31
|
+
async def test_lazy_login(client):
|
|
32
32
|
roles = await client.roles()
|
|
33
33
|
assert roles[0].uid == "4000000001"
|
|
34
34
|
assert roles[0].game_role == "3_4000000001_2"
|
|
35
35
|
assert client.logged_in
|
|
36
36
|
|
|
37
37
|
|
|
38
|
-
async def
|
|
38
|
+
async def test_card_headers(client):
|
|
39
39
|
card = await client.card()
|
|
40
40
|
assert card.name == "Endmin"
|
|
41
41
|
method, url, headers, _ = client.calls[-1]
|
|
@@ -50,7 +50,7 @@ async def test_unknown_uid(client):
|
|
|
50
50
|
await client.card(123)
|
|
51
51
|
|
|
52
52
|
|
|
53
|
-
async def
|
|
53
|
+
async def test_relogin_on_401(client):
|
|
54
54
|
await client.login()
|
|
55
55
|
client.fail_next = [401]
|
|
56
56
|
banners = await client.char_banners()
|
|
@@ -59,21 +59,21 @@ async def test_relogin_once_on_401(client):
|
|
|
59
59
|
assert len(grants) == 2
|
|
60
60
|
|
|
61
61
|
|
|
62
|
-
async def
|
|
62
|
+
async def test_second_401_fails(client):
|
|
63
63
|
await client.login()
|
|
64
64
|
client.fail_next = [401, 401]
|
|
65
65
|
with pytest.raises(AuthError):
|
|
66
66
|
await client.enums()
|
|
67
67
|
|
|
68
68
|
|
|
69
|
-
async def
|
|
69
|
+
async def test_account_email_hidden(client):
|
|
70
70
|
account = await client.account()
|
|
71
71
|
assert account.region == "JP"
|
|
72
72
|
assert "realEmail" not in account.model_dump(by_alias=True)
|
|
73
73
|
assert not hasattr(account, "real_email")
|
|
74
74
|
|
|
75
75
|
|
|
76
|
-
async def
|
|
76
|
+
async def test_raw(client):
|
|
77
77
|
card = await client.card(raw=True)
|
|
78
78
|
assert card["detail"]["base"]["roleId"] == "4000000001"
|
|
79
79
|
assert "calendar" in await client.attendance(raw=True)
|
|
@@ -85,14 +85,14 @@ async def test_raw_returns_untouched_data(client):
|
|
|
85
85
|
assert (await client.account(raw=True))["hgId"] == "1000000001"
|
|
86
86
|
|
|
87
87
|
|
|
88
|
-
async def
|
|
88
|
+
async def test_all_parse(client):
|
|
89
89
|
assert (await client.attendance()).calendar
|
|
90
90
|
assert await client.weapon_banners()
|
|
91
91
|
assert (await client.enums()).label("weapon_type_sword") == "Sword"
|
|
92
92
|
assert (await client.profile()).id
|
|
93
93
|
|
|
94
94
|
|
|
95
|
-
async def
|
|
95
|
+
async def test_character_lookup(client):
|
|
96
96
|
arcane = await client.character("arcane")
|
|
97
97
|
assert arcane.name == "Arcane"
|
|
98
98
|
by_id = await client.character(arcane.id)
|
|
@@ -103,7 +103,7 @@ async def test_character_by_name_id_or_list(client):
|
|
|
103
103
|
assert len(lookups) == 1
|
|
104
104
|
|
|
105
105
|
|
|
106
|
-
async def
|
|
106
|
+
async def test_character_typo(client):
|
|
107
107
|
with pytest.raises(UnknownCharacter, match="did you mean 'Laevatain'"):
|
|
108
108
|
await client.character("laevatian")
|
|
109
109
|
|
|
@@ -129,14 +129,14 @@ async def test_monument(client):
|
|
|
129
129
|
assert url.endswith("/card/indie-hard?roleId=4000000001&serverId=2")
|
|
130
130
|
|
|
131
131
|
|
|
132
|
-
async def
|
|
132
|
+
async def test_relogin_dead_login(client):
|
|
133
133
|
await client.login()
|
|
134
134
|
client.cred = "dead"
|
|
135
135
|
roles = await client.roles()
|
|
136
136
|
assert roles and client.cred != "dead"
|
|
137
137
|
|
|
138
138
|
|
|
139
|
-
async def
|
|
139
|
+
async def test_check_in_dead_login(client):
|
|
140
140
|
await client.login()
|
|
141
141
|
client.cred = "dead"
|
|
142
142
|
result = await client.check_in()
|
|
@@ -145,7 +145,7 @@ async def test_check_in_after_the_login_died(client):
|
|
|
145
145
|
await client.check_in()
|
|
146
146
|
|
|
147
147
|
|
|
148
|
-
async def
|
|
148
|
+
async def test_login_file(tmp_path):
|
|
149
149
|
from tests.conftest import FakeClient
|
|
150
150
|
|
|
151
151
|
file = tmp_path / "login.json"
|
|
@@ -158,13 +158,13 @@ async def test_login_file_skips_logging_in(tmp_path):
|
|
|
158
158
|
assert not FakeClient("other token", login_file=file).logged_in
|
|
159
159
|
|
|
160
160
|
|
|
161
|
-
async def
|
|
161
|
+
async def test_character_one_request(client):
|
|
162
162
|
await client.character("Arcane")
|
|
163
163
|
chars = [u for _, u, _, _ in client.calls if "/card/" in u]
|
|
164
164
|
assert len(chars) == 1 and "/card/detail" in chars[0]
|
|
165
165
|
|
|
166
166
|
|
|
167
|
-
async def
|
|
167
|
+
async def test_cache_hits(client):
|
|
168
168
|
await client.card()
|
|
169
169
|
await client.card()
|
|
170
170
|
assert len([u for _, u, _, _ in client.calls if "/card/detail" in u]) == 1
|
|
@@ -173,7 +173,7 @@ async def test_cache_reuses_answers(client):
|
|
|
173
173
|
assert len([u for _, u, _, _ in client.calls if "/card/detail" in u]) == 2
|
|
174
174
|
|
|
175
175
|
|
|
176
|
-
async def
|
|
176
|
+
async def test_shared_request(client):
|
|
177
177
|
import asyncio
|
|
178
178
|
|
|
179
179
|
await client.roles()
|
|
@@ -181,14 +181,14 @@ async def test_same_request_at_once_goes_out_once(client):
|
|
|
181
181
|
assert len([u for _, u, _, _ in client.calls if "/card/detail" in u]) == 1
|
|
182
182
|
|
|
183
183
|
|
|
184
|
-
async def
|
|
184
|
+
async def test_check_in_clears_attendance(client):
|
|
185
185
|
await client.attendance()
|
|
186
186
|
await client.check_in()
|
|
187
187
|
await client.attendance()
|
|
188
188
|
assert len([u for m, u, _, _ in client.calls if m == "GET" and "/attendance" in u]) == 2
|
|
189
189
|
|
|
190
190
|
|
|
191
|
-
async def
|
|
191
|
+
async def test_cache_off():
|
|
192
192
|
from tests.conftest import FakeClient
|
|
193
193
|
|
|
194
194
|
client = FakeClient("token", cache=False)
|
|
@@ -197,7 +197,7 @@ async def test_cache_can_be_turned_off():
|
|
|
197
197
|
assert len([u for _, u, _, _ in client.calls if "/card/detail" in u]) == 2
|
|
198
198
|
|
|
199
199
|
|
|
200
|
-
async def
|
|
200
|
+
async def test_pulls_after_date(client):
|
|
201
201
|
pages = {
|
|
202
202
|
"": {"list": [{"seqId": "3", "gachaTs": "1793000000000", "rarity": 4}, {"seqId": "2", "gachaTs": "1792000000000", "rarity": 6}], "hasMore": True},
|
|
203
203
|
"2": {"list": [{"seqId": "1", "gachaTs": "1780000000000", "rarity": 4}], "hasMore": False},
|
|
@@ -222,7 +222,7 @@ async def test_news(client):
|
|
|
222
222
|
assert "<" not in news[0].text
|
|
223
223
|
|
|
224
224
|
|
|
225
|
-
async def
|
|
225
|
+
async def test_inventory_names(client):
|
|
226
226
|
inv = await client.inventory()
|
|
227
227
|
assert len(inv.operators) == 6 and len(inv.weapons) == 8
|
|
228
228
|
assert any(o.name for o in inv.operators)
|
|
@@ -239,7 +239,7 @@ async def test_wiki(client):
|
|
|
239
239
|
await client.wiki("nope")
|
|
240
240
|
|
|
241
241
|
|
|
242
|
-
async def
|
|
242
|
+
async def test_debug_log_no_queries(caplog):
|
|
243
243
|
import logging
|
|
244
244
|
|
|
245
245
|
from akef import Client
|
|
@@ -270,7 +270,7 @@ async def test_debug_log_hides_queries(caplog):
|
|
|
270
270
|
assert not any("secret" in m for m in messages)
|
|
271
271
|
|
|
272
272
|
|
|
273
|
-
async def
|
|
273
|
+
async def test_pulls_wrong_uid(client):
|
|
274
274
|
from akef import Pulls
|
|
275
275
|
|
|
276
276
|
role = await client.role()
|
|
@@ -58,13 +58,13 @@ async def test_enka_profile(profile):
|
|
|
58
58
|
|
|
59
59
|
|
|
60
60
|
@pytest.mark.parametrize("name", list(ENKA))
|
|
61
|
-
async def
|
|
61
|
+
async def test_enka_stats(profile, name):
|
|
62
62
|
stats = profile.build(name).stats
|
|
63
63
|
for field, want in ENKA[name].items():
|
|
64
64
|
assert shown(getattr(stats, field)) == shown(want), field
|
|
65
65
|
|
|
66
66
|
|
|
67
|
-
async def
|
|
67
|
+
async def test_enka_build(profile):
|
|
68
68
|
arcane = profile.build("Arcane")
|
|
69
69
|
assert [s.level for s in arcane.skills] == [10, 11, 11, 12]
|
|
70
70
|
assert arcane.weapon.name == "Type 42: Solemn Phalanx"
|
|
@@ -77,7 +77,7 @@ async def test_enka_build_details(profile):
|
|
|
77
77
|
assert sum(t.unlocked for t in arcane.talents) == len(arcane.talents)
|
|
78
78
|
|
|
79
79
|
|
|
80
|
-
async def
|
|
80
|
+
async def test_skport_vs_enka(data):
|
|
81
81
|
card = skport_card()
|
|
82
82
|
build = build_from_skport(data, card, card.character("Arcane"))
|
|
83
83
|
assert (build.stats.hp, build.stats.atk, build.stats.intellect, build.stats.will) == (6950, 4802, 430, 765)
|
|
@@ -87,7 +87,7 @@ async def test_skport_build_matches_enka(data):
|
|
|
87
87
|
assert essence.badge.startswith("https://static.skport.com/")
|
|
88
88
|
|
|
89
89
|
|
|
90
|
-
async def
|
|
90
|
+
async def test_weapon_essence_stats(data, profile):
|
|
91
91
|
card = skport_card()
|
|
92
92
|
enka = profile.build("Arcane").weapon
|
|
93
93
|
assert [(s.name, s.value, s.stat, s.level) for s in enka.skills] == [
|
|
@@ -98,13 +98,13 @@ async def test_weapon_and_essence_stats_match(data, profile):
|
|
|
98
98
|
assert [t.points for t in skport.essence.terms] == [6, 6, 3]
|
|
99
99
|
|
|
100
100
|
|
|
101
|
-
async def
|
|
101
|
+
async def test_shared_essence_base(data, profile):
|
|
102
102
|
card = skport_card()
|
|
103
103
|
skport = build_from_skport(data, card, card.character("Arcane")).weapon.essence
|
|
104
104
|
assert skport.icon == profile.build("Arcane").weapon.essence.icon
|
|
105
105
|
|
|
106
106
|
|
|
107
|
-
async def
|
|
107
|
+
async def test_icons(profile):
|
|
108
108
|
si = profile.build("Si")
|
|
109
109
|
assert si.element_icon.endswith("/attributeicon/CrystDamageIncrease.png")
|
|
110
110
|
assert si.weapon.essence.badge.endswith(".png")
|
|
@@ -119,12 +119,12 @@ def test_tier_unlocked():
|
|
|
119
119
|
assert not tier_unlocked("chr_x_passive_skill_1_1", latest)
|
|
120
120
|
|
|
121
121
|
|
|
122
|
-
def
|
|
122
|
+
def test_talent_icon():
|
|
123
123
|
assert talent_icon("/ui/ef/icon_talent_x_01.png").endswith("/ui/ef/skillicon/icon_talent_x_01.png")
|
|
124
124
|
assert talent_icon("/ui/ef/spaceshipskillicon/a.png").endswith("/ui/ef/spaceshipskillicon/a.png")
|
|
125
125
|
|
|
126
126
|
|
|
127
|
-
async def
|
|
127
|
+
async def test_talent_groups(profile):
|
|
128
128
|
for build in profile.builds:
|
|
129
129
|
kinds = [t.kind for t in build.talents]
|
|
130
130
|
assert kinds[0] == "attribute" and kinds.count("attribute") == 1
|
|
@@ -147,7 +147,7 @@ async def test_enka_player(profile):
|
|
|
147
147
|
assert player.avatar.endswith(".png") and player.namecard.endswith(".png")
|
|
148
148
|
|
|
149
149
|
|
|
150
|
-
def
|
|
150
|
+
def test_skport_player_order():
|
|
151
151
|
card = skport_card()
|
|
152
152
|
player = player_from_skport(card)
|
|
153
153
|
picked = [c.name for c in card.showcased]
|
|
@@ -155,7 +155,7 @@ def test_skport_player_keeps_the_showcase_first():
|
|
|
155
155
|
assert len(player.roster) == len(card.chars)
|
|
156
156
|
|
|
157
157
|
|
|
158
|
-
async def
|
|
158
|
+
async def test_enka_cache(monkeypatch, data):
|
|
159
159
|
from akef.enka import client as module
|
|
160
160
|
|
|
161
161
|
calls = []
|
|
@@ -173,7 +173,7 @@ async def test_enka_answers_are_reused(monkeypatch, data):
|
|
|
173
173
|
assert calls == [1, 1]
|
|
174
174
|
|
|
175
175
|
|
|
176
|
-
async def
|
|
176
|
+
async def test_unknown_operator(data):
|
|
177
177
|
with pytest.raises(akef.UnknownCharacter):
|
|
178
178
|
await akef.Enka(data=data).build(skport_card(), "Nobody")
|
|
179
179
|
|
|
@@ -186,7 +186,7 @@ def test_language_codes():
|
|
|
186
186
|
language("klingon")
|
|
187
187
|
|
|
188
188
|
|
|
189
|
-
async def
|
|
189
|
+
async def test_names_any_language(data):
|
|
190
190
|
locs = data._tables["locs"]
|
|
191
191
|
weapon = next(iter(data.weapons.values()))
|
|
192
192
|
for names in locs.values():
|
|
@@ -45,7 +45,7 @@ def test_character():
|
|
|
45
45
|
assert arcane.skill_level(skill.id) == 10
|
|
46
46
|
|
|
47
47
|
|
|
48
|
-
def
|
|
48
|
+
def test_lower_tiers_unlocked():
|
|
49
49
|
arcane = card().character("arcane")
|
|
50
50
|
assert len(arcane.talents) == 12
|
|
51
51
|
assert len(arcane.unlocked_talents) == 12
|
|
@@ -113,7 +113,7 @@ def test_profile():
|
|
|
113
113
|
assert p.user_rts.fans == 0
|
|
114
114
|
|
|
115
115
|
|
|
116
|
-
def
|
|
116
|
+
def test_showcase_order():
|
|
117
117
|
card = Card.model_validate(load("card_detail")["data"]["detail"])
|
|
118
118
|
assert [c.id for c in card.showcased] == card.config.char_ids[:len(card.showcased)]
|
|
119
119
|
assert card.showcased[0].name == "Arcane"
|
|
@@ -148,7 +148,7 @@ def test_pity_per_banner():
|
|
|
148
148
|
assert len(p.gifts) == 3
|
|
149
149
|
|
|
150
150
|
|
|
151
|
-
def
|
|
151
|
+
def test_free_pulls():
|
|
152
152
|
from akef import Pull, since_last
|
|
153
153
|
|
|
154
154
|
rows = [Pull(rarity=6), Pull(rarity=4), Pull(rarity=4, is_free=True), Pull(rarity=5)]
|
|
@@ -189,7 +189,7 @@ def test_wiki_page_reading():
|
|
|
189
189
|
assert (skill.name, skill.kind, skill.icon, skill.text) == ("Gloompurge", "Ultimate", "i.png", "Hits hard.\nTwice.")
|
|
190
190
|
|
|
191
191
|
|
|
192
|
-
def
|
|
192
|
+
def test_wiki_tables():
|
|
193
193
|
from akef import WikiItem
|
|
194
194
|
|
|
195
195
|
blocks = {
|
|
@@ -205,7 +205,7 @@ def test_wiki_tables_keep_links_and_lines():
|
|
|
205
205
|
assert (table.rows[0][1].links[0].id, table.rows[0][1].links[0].count) == ("109", 5)
|
|
206
206
|
|
|
207
207
|
|
|
208
|
-
def
|
|
208
|
+
def test_pulls_json(tmp_path):
|
|
209
209
|
from akef import Pull, Pulls
|
|
210
210
|
|
|
211
211
|
pulls = Pulls(
|
|
@@ -225,7 +225,7 @@ def test_pulls_round_trip_through_json(tmp_path):
|
|
|
225
225
|
assert header.startswith("uid,group,kind,banner") and first.startswith("4727743200,operators,draw,special")
|
|
226
226
|
|
|
227
227
|
|
|
228
|
-
def
|
|
228
|
+
def test_contract_detail():
|
|
229
229
|
from akef import ContractDetail
|
|
230
230
|
from akef.models.card import fill
|
|
231
231
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
from akef.signing import base_headers, sign
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
def
|
|
4
|
+
def test_header_order():
|
|
5
5
|
assert list(base_headers("1")) == ["platform", "timestamp", "dId", "vName"]
|
|
6
6
|
|
|
7
7
|
|
|
@@ -11,7 +11,7 @@ def test_sign_is_stable():
|
|
|
11
11
|
assert out["sign"] == "4fe5e21c32a5e43d998a5e578e75adc7"
|
|
12
12
|
|
|
13
13
|
|
|
14
|
-
def
|
|
14
|
+
def test_query_sign():
|
|
15
15
|
salt = "0123456789abcdef0123456789abcdef"
|
|
16
16
|
a = sign("/api/v1/game/endfield/card/detail", "roleId=1&serverId=2", salt, ts="1")
|
|
17
17
|
b = sign("/api/v1/game/endfield/card/detail", "roleId=1&serverId=3", salt, ts="1")
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|