mirror of
https://github.com/chatmail/relay.git
synced 2026-05-20 04:48:06 +00:00
cmdeploy: test if ini was overwritten with --force2
This commit is contained in:
@@ -47,10 +47,11 @@ def init_cmd(args, out):
|
|||||||
if args.inipath.exists():
|
if args.inipath.exists():
|
||||||
if not args.recreate_ini:
|
if not args.recreate_ini:
|
||||||
out.green(f"[WARNING] Path exists, not modifying: {inipath}")
|
out.green(f"[WARNING] Path exists, not modifying: {inipath}")
|
||||||
return 0
|
return 1
|
||||||
else:
|
else:
|
||||||
out.yellow(f"[WARNING] Force argument was provided, deleting config file: {inipath}")
|
out.yellow(f"[WARNING] Force argument was provided, deleting config file: {inipath}")
|
||||||
inipath.unlink()
|
inipath.unlink()
|
||||||
|
return 0
|
||||||
|
|
||||||
write_initial_config(inipath, mail_domain, overrides={})
|
write_initial_config(inipath, mail_domain, overrides={})
|
||||||
out.green(f"created config file for {mail_domain} in {inipath}")
|
out.green(f"created config file for {mail_domain} in {inipath}")
|
||||||
|
|||||||
@@ -27,3 +27,6 @@ class TestCmdline:
|
|||||||
assert main(["init", "chat.example.org"]) == 1
|
assert main(["init", "chat.example.org"]) == 1
|
||||||
out, err = capsys.readouterr()
|
out, err = capsys.readouterr()
|
||||||
assert "path exists" in out.lower()
|
assert "path exists" in out.lower()
|
||||||
|
assert main(["init", "chat.example.org", "--force"]) == 0
|
||||||
|
out, err = capsys.readouterr()
|
||||||
|
assert "deleting config file" in out.lower()
|
||||||
|
|||||||
Reference in New Issue
Block a user