Skip to content

Commit

Permalink
Merge branch 'folder-http-endpoint' into folder-endpoint-access
Browse files Browse the repository at this point in the history
# Conflicts:
#	runhouse/servers/http/http_utils.py
  • Loading branch information
jlewitt1 committed Aug 6, 2024
2 parents 03640e4 + 9794d5a commit dd1312d
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 70 deletions.
4 changes: 0 additions & 4 deletions runhouse/servers/http/http_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,3 @@ def folder_mv(path: Path, folder_params: FolderParams):
shutil.move(str(path), str(dest_path))

return Response(output_type=OutputType.SUCCESS)


# folder_put(Path("/Users/josh.l/dev/runhouse/runhouse/servers/http"), FolderParams(operation="put", contents={"test.txt": "Hello World!"}))
folder_ls(Path("/Users/josh.l/dev/runhouse/runhouse/servers/http"), FolderParams())
66 changes: 0 additions & 66 deletions tests/test_servers/test_http_server.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import json
import os
import tempfile
from pathlib import Path

Expand All @@ -21,7 +20,6 @@

INVALID_HEADERS = {"Authorization": "Bearer InvalidToken"}


# Helper used for testing rh.Function
def summer(a, b):
return a + b
Expand Down Expand Up @@ -107,70 +105,6 @@ def test_rename_object(self, http_client, cluster):
)
assert new_key in response.json().get("data")

@pytest.mark.level("local")
def test_folder_ls(self, http_client, cluster):
response = http_client.post(
"/folder",
json={"operation": "ls", "path": "~"},
headers=rns_client.request_headers(cluster.rns_address),
)
assert response.status_code == 200

file_names: list = response.json().get("data")
base_names = [os.path.basename(f) for f in file_names]
assert ".rh" in base_names

@pytest.mark.level("local")
def test_folder_put_and_get(self, http_client, cluster):
response = http_client.post(
"/folder",
json={
"operation": "put",
"path": "~/.rh",
"contents": {"new_file.txt": "Hello, world!"},
},
headers=rns_client.request_headers(cluster.rns_address),
)
assert response.status_code == 200

response = http_client.post(
"/folder",
json={"operation": "get", "path": "~/.rh/new_file.txt"},
headers=rns_client.request_headers(cluster.rns_address),
)
assert response.status_code == 200

@pytest.mark.level("local")
def test_folder_mkdir(self, http_client, cluster):
response = http_client.post(
"/folder",
json={"operation": "mkdir", "path": "~/.rh/new-folder"},
headers=rns_client.request_headers(cluster.rns_address),
)
assert response.status_code == 200

@pytest.mark.level("local")
def test_folder_rm(self, http_client, cluster):
# Delete the file
response = http_client.post(
"/folder",
json={
"operation": "rm",
"path": "~/.rh/new-folder",
"contents": ["new_file.txt"],
},
headers=rns_client.request_headers(cluster.rns_address),
)
assert response.status_code == 200

# Delete the folder
response = http_client.post(
"/folder",
json={"operation": "rm", "path": "~/.rh/new-folder"},
headers=rns_client.request_headers(cluster.rns_address),
)
assert response.status_code == 200

@pytest.mark.level("local")
def test_delete_obj(self, http_client, cluster):
# https://www.python-httpx.org/compatibility/#request-body-on-http-methods
Expand Down

0 comments on commit dd1312d

Please sign in to comment.