33 lines
1.0 KiB
Python
33 lines
1.0 KiB
Python
from pathlib import Path
|
|
|
|
ROOT = Path(__file__).resolve().parents[1]
|
|
|
|
|
|
def read(path: str) -> str:
|
|
return (ROOT / path).read_text()
|
|
|
|
|
|
def test_dialect_query_catalogs_are_intentionally_warning_silent():
|
|
mod = read("src/queries/mod.rs")
|
|
for dialect in ("sqlite", "mysql", "pgsql"):
|
|
assert f"#[allow(dead_code)]\npub mod {dialect};" in mod
|
|
|
|
|
|
def test_test_only_session_helpers_do_not_enter_production_build():
|
|
session = read("src/auth/session.rs")
|
|
signatures = [
|
|
"pub fn new(timeout: Duration) -> Self",
|
|
"pub fn new_with_tls_verify(timeout: Duration, tls_verify_override: Option<bool>) -> Self",
|
|
"pub fn add_account_to_browser(",
|
|
]
|
|
for signature in signatures:
|
|
pos = session.index(signature)
|
|
prefix = session[max(0, pos - 120):pos]
|
|
assert "#[cfg(test)]" in prefix
|
|
|
|
|
|
def test_test_only_rfc822_helper_does_not_enter_production_build():
|
|
builder = read("src/smtp/builder.rs")
|
|
pos = builder.index("pub fn build_rfc822")
|
|
assert "#[cfg(test)]" in builder[max(0, pos - 80):pos]
|