Skip to content

Commit

Permalink
Fixed error with 'datasette publish now' alias, closes #31
Browse files Browse the repository at this point in the history
  • Loading branch information
simonw committed Dec 28, 2020
1 parent 4884ed4 commit 4dfd710
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 108 deletions.
110 changes: 4 additions & 106 deletions datasette_publish_vercel/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,115 +262,13 @@ def publish_subcommand(publish):
@publish.command()
@add_common_publish_arguments_and_options
@add_vercel_options
def vercel(
files,
metadata,
extra_options,
branch,
template_dir,
plugins_dir,
static,
install,
plugin_secret,
version_note,
secret,
title,
license,
license_url,
source,
source_url,
about,
about_url,
token,
project,
no_prod,
debug,
public,
generate_dir,
settings,
):
def vercel(*args, **kwargs):
"Publish to https://vercel.com/"
_publish_vercel(
files,
metadata,
extra_options,
branch,
template_dir,
plugins_dir,
static,
install,
plugin_secret,
version_note,
secret,
title,
license,
license_url,
source,
source_url,
about,
about_url,
token,
project,
no_prod,
debug,
public,
generate_dir,
settings,
)
_publish_vercel(*args, **kwargs)

@publish.command()
@add_common_publish_arguments_and_options
@add_vercel_options
def now(
files,
metadata,
extra_options,
branch,
template_dir,
plugins_dir,
static,
install,
plugin_secret,
version_note,
secret,
title,
license,
license_url,
source,
source_url,
about,
about_url,
token,
project,
no_prod,
debug,
public,
generate_dir,
):
def now(*args, **kwargs):
"Alias for 'datasette publish vercel'"
_publish_vercel(
files,
metadata,
extra_options,
branch,
template_dir,
plugins_dir,
static,
install,
plugin_secret,
version_note,
secret,
title,
license,
license_url,
source,
source_url,
about,
about_url,
token,
project,
no_prod,
debug,
public,
generate_dir,
)
_publish_vercel(*args, **kwargs)
5 changes: 3 additions & 2 deletions tests/test_publish_vercel.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,16 @@ def test_publish_vercel_requires_project(mock_which):

@mock.patch("shutil.which")
@mock.patch("datasette_publish_vercel.run")
def test_publish_vercel(mock_run, mock_which):
@pytest.mark.parametrize("alias", ["vercel", "now"])
def test_publish_vercel(mock_run, mock_which, alias):
mock_which.return_value = True
mock_run.return_value = mock.Mock(0)
runner = CliRunner()
with runner.isolated_filesystem():
open("test.db", "w").write("data")
result = runner.invoke(
cli.cli,
["publish", "vercel", "test.db", "--project", "foo", "--secret", "S"],
["publish", alias, "test.db", "--project", "foo", "--secret", "S"],
)
assert result.exit_code == 0
mock_run.assert_has_calls(
Expand Down

0 comments on commit 4dfd710

Please sign in to comment.