-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_about.py
More file actions
73 lines (60 loc) · 2.43 KB
/
Copy pathtest_about.py
File metadata and controls
73 lines (60 loc) · 2.43 KB
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
from __future__ import annotations
from pathlib import Path
from app.context import VERSION
from app.fragments.about import about_fragment
from app.schemas import CommitStatus
from tests.test_admin import _assert_about_surface
SOCIAL = Path(__file__).resolve().parents[1] / "app" / "webui" / "brand" / "social"
SHA = "0979263b31465a19a6c5fa375ccdd0f2af250ca5"
def test_about_fragment_has_the_family_surface() -> None:
html = about_fragment(VERSION)
_assert_about_surface(html)
assert "Beta" in html
assert "Early" not in html
assert "https://discord.gg/t6muquAJbm" in html
assert VERSION in html
assert "<dt>Version</dt>" in html
assert "<dt>Build</dt>" not in html
def test_about_fragment_shows_commit_when_given() -> None:
html = about_fragment(
VERSION,
CommitStatus(sha=SHA, short_sha="0979263", subject="Add About tab"),
)
assert "<dt>Build</dt>" in html
assert "0979263" in html
assert f'title="{SHA}"' in html
assert "Add About tab" not in html
def test_social_marks_are_the_official_files() -> None:
discord = (SOCIAL / "discord.svg").read_text(encoding="utf-8")
x_mark = (SOCIAL / "x.svg").read_text(encoding="utf-8")
github = (SOCIAL / "github.svg").read_text(encoding="utf-8")
mail = (SOCIAL / "mail.svg").read_text(encoding="utf-8")
for svg in (discord, x_mark, github, mail):
assert 'viewBox="0 0 24 24"' in svg
assert 'fill="currentColor"' in svg
assert "5865F2" not in svg
assert "#000" not in svg
assert "M20.317 4.3698" in discord
assert "M18.901 1.153" in x_mark
assert "M12 .297" in github
assert "M3 5h18a2 2 0 0 1 2 2v10" in mail
def test_official_1u_mark_is_vendored() -> None:
mark = (
Path(__file__).resolve().parents[1]
/ "app"
/ "webui"
/ "brand"
/ "vocagateway"
/ "vocagateway-1u.svg"
).read_text(encoding="utf-8")
assert 'viewBox="0 0 1024 1024"' in mark
assert "#0F6B57" in mark
assert "#F2F6F2" in mark
assert 'aria-label="VocaGateway"' in mark
def test_about_styles_reuse_webui_chrome() -> None:
css = (Path(__file__).resolve().parents[1] / "app" / "webui" / "styles.css").read_text()
assert "text-transform: uppercase" not in css.split("/* About reuses")[1]
assert "about-kicker" not in css
assert "about-card-kicker" not in css
assert ".about-icon" in css
assert "5865F2" not in css.split("/* About reuses")[1]