kopia lustrzana https://github.com/simonw/datasette
Pass --token to now alias, refs #459
rodzic
09ef305c68
commit
05cabaebd9
|
@ -92,8 +92,10 @@ def publish_subcommand(publish):
|
||||||
# I couldn't get --target=production working, so I call
|
# I couldn't get --target=production working, so I call
|
||||||
# 'now alias' with arguments directly instead - but that
|
# 'now alias' with arguments directly instead - but that
|
||||||
# means I need to figure out what URL it was deployed to.
|
# means I need to figure out what URL it was deployed to.
|
||||||
for single_alias in alias:
|
for single_alias in alias: # --alias can be specified multiple times
|
||||||
# Because --alias can be specified multiple times
|
args = ["now", "alias", deployment_url, single_alias]
|
||||||
run(["now", "alias", deployment_url, single_alias])
|
if token:
|
||||||
|
args.append("--token={}".format(token))
|
||||||
|
run(args)
|
||||||
else:
|
else:
|
||||||
print(deployment_url.decode("latin1"))
|
print(deployment_url.decode("latin1"))
|
||||||
|
|
|
@ -63,12 +63,40 @@ def test_publish_now_multiple_aliases(mock_run, mock_which):
|
||||||
open("test.db", "w").write("data")
|
open("test.db", "w").write("data")
|
||||||
runner.invoke(
|
runner.invoke(
|
||||||
cli.cli,
|
cli.cli,
|
||||||
["publish", "now", "test.db", "--alias", "alias1", "--alias", "alias2"],
|
[
|
||||||
|
"publish",
|
||||||
|
"now",
|
||||||
|
"test.db",
|
||||||
|
"--token",
|
||||||
|
"XXX",
|
||||||
|
"--alias",
|
||||||
|
"alias1",
|
||||||
|
"--alias",
|
||||||
|
"alias2",
|
||||||
|
],
|
||||||
)
|
)
|
||||||
mock_run.assert_has_calls(
|
mock_run.assert_has_calls(
|
||||||
[
|
[
|
||||||
mock.call("now", stdout=subprocess.PIPE),
|
mock.call(["now", "--token", "XXX"], stdout=subprocess.PIPE),
|
||||||
mock.call(["now", "alias", b"https://demo.example.com/", "alias1"]),
|
mock.call(
|
||||||
mock.call(["now", "alias", b"https://demo.example.com/", "alias2"]),
|
[
|
||||||
|
"now",
|
||||||
|
"alias",
|
||||||
|
b"https://demo.example.com/",
|
||||||
|
"alias1",
|
||||||
|
"--token",
|
||||||
|
"XXX",
|
||||||
|
]
|
||||||
|
),
|
||||||
|
mock.call(
|
||||||
|
[
|
||||||
|
"now",
|
||||||
|
"alias",
|
||||||
|
b"https://demo.example.com/",
|
||||||
|
"alias2",
|
||||||
|
"--token",
|
||||||
|
"XXX",
|
||||||
|
]
|
||||||
|
),
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
|
Ładowanie…
Reference in New Issue