Pass --token to now alias, refs #459

debug-travis
Simon Willison 2019-05-11 13:35:34 -07:00
rodzic 09ef305c68
commit 05cabaebd9
2 zmienionych plików z 37 dodań i 7 usunięć

Wyświetl plik

@ -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"))

Wyświetl plik

@ -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",
]
),
] ]
) )