Skip to content

Commit

Permalink
Clear out various bits of .storage
Browse files Browse the repository at this point in the history
  • Loading branch information
palfrey committed Apr 3, 2024
1 parent 0499a70 commit e747676
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 38 deletions.
2 changes: 1 addition & 1 deletion .python-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.11
3.12
10 changes: 0 additions & 10 deletions integration_tests/config/.storage/core.analytics

This file was deleted.

18 changes: 0 additions & 18 deletions integration_tests/config/.storage/core.config

This file was deleted.

8 changes: 0 additions & 8 deletions integration_tests/config/.storage/http.auth

This file was deleted.

32 changes: 31 additions & 1 deletion integration_tests/test_banning_works.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,35 @@ def configure_ha(allowlist: list[str]) -> None:
subprocess.check_call(["docker-compose", "down"])
if ban_ip_path.exists():
ban_ip_path.unlink()

for dirpath, dirnames, filenames in config_folder.walk(top_down=True):
if "custom_components" in dirnames:
dirnames.remove("custom_components")
keep_filenames = {
"configuration.yaml.j2",
"configuration.yaml",
"home-assistant.log",
".gitignore",
"auth",
"auth_provider.homeassistant",
"core.restore_state",
"onboarding",
"person",
}
delete_files = set(filenames) - keep_filenames
if len(delete_files) == 0:
continue
print("deleting", delete_files)
for filename in delete_files:
delete_path = dirpath.joinpath(filename)
delete_path.unlink()

subprocess.check_call(
["docker-compose", "up", "-d"],
env={**os.environ, "UID": str(os.getuid()), "GID": str(os.getgid())},
)
wait_for_http(8123)
time.sleep(1)


def check_res(expected_results: list[int]):
Expand All @@ -87,12 +111,18 @@ def check_res(expected_results: list[int]):
"""
try:
for index in range(len(expected_results)):
# Tried less terrible URLS (e.g. just /api/) and they don't seem to reliably work
# This one to a generally non-existant login flow, seems to work reliably
res = requests.post(
"http://localhost:8123/auth/login_flow/b4b20b5004a6baa2a1d903de46886ed2",
json={"client_id": "http://localhost:8123/"},
)
assert res.ok is False, (res, res.text)
assert res.status_code == expected_results[index], (res, res.text)
assert res.status_code == expected_results[index], (
res.status_code,
expected_results[index],
res.text,
)
finally:
subprocess.check_call(["docker-compose", "down"])

Expand Down

0 comments on commit e747676

Please sign in to comment.