Skip to content

Commit 67408b1

Browse files
committed
PA-655 stub subcommands for get, reload, and delete. by: Piotr, Giles
1 parent 552bbaa commit 67408b1

File tree

2 files changed

+113
-2
lines changed

2 files changed

+113
-2
lines changed

cli/website.py

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,43 @@ def create(
2929

3030

3131
@app.command()
32-
def delete():
32+
def get(
33+
domain_name: str = typer.Option(
34+
None,
35+
"-d",
36+
"--domain",
37+
help="Get details for domain name, eg. yourusername.pythonanywhere.com or www.mydomain.com",
38+
)
39+
):
40+
"""If no domain name is specified, list all domains. Otherwise get details for specified domain"""
41+
pass
42+
43+
44+
@app.command()
45+
def reload(
46+
domain_name: Annotated[
47+
str,
48+
typer.Option(
49+
"-d",
50+
"--domain",
51+
help="Domain name, eg. yourusername.pythonanywhere.com or www.mydomain.com",
52+
)
53+
],
54+
):
55+
"""Reload the website at the given domain"""
56+
pass
57+
58+
59+
@app.command()
60+
def delete(
61+
domain_name: Annotated[
62+
str,
63+
typer.Option(
64+
"-d",
65+
"--domain",
66+
help="Domain name, eg. yourusername.pythonanywhere.com or www.mydomain.com",
67+
)
68+
],
69+
):
70+
"""Delete the website at the given domain"""
3371
pass

tests/test_cli_website.py

Lines changed: 74 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def test_create_without_command_barfs():
4040
assert "Missing option" in result.stdout
4141

4242

43-
def test_create_with_domain_and_command_does_something():
43+
def test_create_with_domain_and_command_creates_it():
4444
result = runner.invoke(
4545
app,
4646
[
@@ -52,5 +52,78 @@ def test_create_with_domain_and_command_does_something():
5252
],
5353
)
5454
assert result.exit_code == 0
55+
assert False, "TODO"
5556

5657

58+
def test_get_with_no_domain_lists_websites():
59+
result = runner.invoke(
60+
app,
61+
[
62+
"get",
63+
],
64+
)
65+
assert result.exit_code == 0
66+
assert False, "TODO"
67+
68+
69+
def test_get_with_domain_gives_details_for_domain():
70+
result = runner.invoke(
71+
app,
72+
[
73+
"get",
74+
"-d",
75+
"www.domain.com",
76+
],
77+
)
78+
print(result.stdout)
79+
assert result.exit_code == 0
80+
assert False, "TODO"
81+
82+
83+
def test_reload_with_no_domain_barfs():
84+
result = runner.invoke(
85+
app,
86+
[
87+
"reload",
88+
],
89+
)
90+
assert result.exit_code != 0
91+
assert "Missing option" in result.stdout
92+
93+
94+
def test_reload_with_domain_reloads():
95+
result = runner.invoke(
96+
app,
97+
[
98+
"reload",
99+
"-d",
100+
"www.domain.com",
101+
],
102+
)
103+
assert result.exit_code == 0
104+
assert False, "TODO"
105+
106+
107+
def test_delete_with_no_domain_barfs():
108+
result = runner.invoke(
109+
app,
110+
[
111+
"delete",
112+
],
113+
)
114+
assert result.exit_code != 0
115+
assert "Missing option" in result.stdout
116+
117+
118+
def test_delete_with_domain_deletes_it():
119+
result = runner.invoke(
120+
app,
121+
[
122+
"delete",
123+
"-d",
124+
"www.domain.com",
125+
],
126+
)
127+
assert result.exit_code == 0
128+
assert False, "TODO"
129+

0 commit comments

Comments
 (0)