Skip to content

Commit

Permalink
Merge pull request #2022 from rkoumis/test-agent-exist-ok-true
Browse files Browse the repository at this point in the history
Ask the agent to create a directory that already exists
  • Loading branch information
doomedraven authored Mar 22, 2024
2 parents 3f06c39 + 8a39864 commit 7682dd8
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions agent/test_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -369,14 +369,18 @@ def test_mkdir_valid(self):
assert os.path.exists(new_dir)
assert os.path.isdir(new_dir)

def test_mkdir_invalid(self):
def test_mkdir_missing(self):
"""Ensure we get an error returned when the mkdir request fails."""
form = {}
js = self.post_form("mkdir", form, 400)
assert js["message"] == "No dirpath has been provided"

root = pathlib.Path(tempfile.gettempdir()).root
form = {"dirpath": root, "mode": 0o777}
@pytest.mark.skip("Not many paths are actually invalid")
def test_mkdir_invalid(self):
"""Ensure we get an error returned when the mkdir request fails."""
# TODO come up with an invalid directory path for windows / linux
invalid = ""
form = {"dirpath": invalid, "mode": 0o777}
js = self.post_form("mkdir", form, 500)
assert js["message"] == "Error creating directory"

Expand Down

0 comments on commit 7682dd8

Please sign in to comment.