fix(install): a fresh install creates ntfy accounts without prompts (database created first; phone uses the web password)
This commit is contained in:
@@ -29,6 +29,24 @@ def resolution():
|
||||
"version": NTFY_VERSION, "tag": "v" + NTFY_VERSION}
|
||||
|
||||
|
||||
class _Served:
|
||||
def poll(self):
|
||||
return None
|
||||
|
||||
def terminate(self):
|
||||
pass
|
||||
|
||||
def wait(self, timeout=None):
|
||||
return 0
|
||||
|
||||
|
||||
def fake_ntfy_serve(command, **kwargs):
|
||||
"""`ntfy serve` creates its account database next to its configuration."""
|
||||
config = Path(command[command.index("--config") + 1])
|
||||
(config.parent / "auth.db").write_bytes(b"")
|
||||
return _Served()
|
||||
|
||||
|
||||
class Recorder:
|
||||
def __init__(self, token=TOKEN, volumes=(), image="pipelines-pipelines:latest",
|
||||
fail_create=False, fail_copy=False, fail_volume_ls=False, fail_build=False,
|
||||
@@ -115,7 +133,7 @@ class SetupNativeTests(unittest.TestCase):
|
||||
# A disposable XDG config home keeps the client default out of the real
|
||||
# user configuration during tests.
|
||||
return setup_native.Setup(directory, prefix=Path(directory) / "prefix", runner=recorder,
|
||||
resolver=resolution,
|
||||
resolver=resolution, popen=fake_ntfy_serve,
|
||||
environ={"XDG_CONFIG_HOME": str(Path(directory) / "config"),
|
||||
"PIPELINES_WEB_PASSWORD": "chosen-password"})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user