Skip to content

Commit

Permalink
PA-655 delete domain from command line. by: Filip, Giles
Browse files Browse the repository at this point in the history
  • Loading branch information
gpjt committed Jul 10, 2024
1 parent 2e60767 commit e48738f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
5 changes: 3 additions & 2 deletions cli/website.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def reload(
):
"""Reload the website at the given domain"""
Website().reload(domain_name=domain_name)
typer.echo(snakesay(f"Website {domain_name} reloaded!"))
typer.echo(snakesay(f"Website {domain_name} has been reloaded!"))


@app.command()
Expand All @@ -107,4 +107,5 @@ def delete(
],
):
"""Delete the website at the given domain"""
pass
Website().delete(domain_name=domain_name)
typer.echo(snakesay(f"Website {domain_name} has been deleted!"))
14 changes: 11 additions & 3 deletions tests/test_cli_website.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ def test_reload_with_domain_reloads(mocker):

assert result.exit_code == 0
mock_website.return_value.reload.assert_called_once_with(domain_name="www.domain.com")
mock_snakesay.assert_called_once_with(f"Website www.domain.com reloaded!")
mock_snakesay.assert_called_once_with(f"Website www.domain.com has been reloaded!")
mock_echo.assert_called_once_with(mock_snakesay.return_value)


Expand All @@ -200,7 +200,11 @@ def test_delete_with_no_domain_barfs():
assert "Missing option" in result.stdout


def test_delete_with_domain_deletes_it():
def test_delete_with_domain_deletes_it(mocker):
mock_website = mocker.patch("cli.website.Website")
mock_snakesay = mocker.patch("cli.website.snakesay")
mock_echo = mocker.patch("cli.website.typer.echo")

result = runner.invoke(
app,
[
Expand All @@ -209,5 +213,9 @@ def test_delete_with_domain_deletes_it():
"www.domain.com",
],
)

assert result.exit_code == 0
assert False, "TODO"
mock_website.return_value.delete.assert_called_once_with(domain_name="www.domain.com")
mock_snakesay.assert_called_once_with(f"Website www.domain.com has been deleted!")
mock_echo.assert_called_once_with(mock_snakesay.return_value)

0 comments on commit e48738f

Please sign in to comment.