Skip to content

Commit 2e60767

Browse files
committed
PA-655 Implementing Website.reload, by: Giles, Piotr
1 parent 1b36d2f commit 2e60767

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

cli/website.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,8 @@ def reload(
9191
],
9292
):
9393
"""Reload the website at the given domain"""
94-
pass
94+
Website().reload(domain_name=domain_name)
95+
typer.echo(snakesay(f"Website {domain_name} reloaded!"))
9596

9697

9798
@app.command()

tests/test_cli_website.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ def test_get_with_no_domain_lists_websites(mocker, website_info):
126126
)
127127
mock_echo.assert_called_once_with(mock_tabulate.return_value)
128128

129+
129130
def test_get_with_domain_gives_details_for_domain(mocker, website_info, domain_name):
130131
mock_website = mocker.patch("cli.website.Website")
131132
mock_website.return_value.get.return_value = website_info
@@ -168,7 +169,11 @@ def test_reload_with_no_domain_barfs():
168169
assert "Missing option" in result.stdout
169170

170171

171-
def test_reload_with_domain_reloads():
172+
def test_reload_with_domain_reloads(mocker):
173+
mock_website = mocker.patch("cli.website.Website")
174+
mock_snakesay = mocker.patch("cli.website.snakesay")
175+
mock_echo = mocker.patch("cli.website.typer.echo")
176+
172177
result = runner.invoke(
173178
app,
174179
[
@@ -177,8 +182,11 @@ def test_reload_with_domain_reloads():
177182
"www.domain.com",
178183
],
179184
)
185+
180186
assert result.exit_code == 0
181-
assert False, "TODO"
187+
mock_website.return_value.reload.assert_called_once_with(domain_name="www.domain.com")
188+
mock_snakesay.assert_called_once_with(f"Website www.domain.com reloaded!")
189+
mock_echo.assert_called_once_with(mock_snakesay.return_value)
182190

183191

184192
def test_delete_with_no_domain_barfs():

0 commit comments

Comments
 (0)