Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix .as_uri() and .absolute() implementations for WorkspacePath #127

Merged
merged 4 commits into from
Jul 12, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Unit test for .as_uri() implementation.
  • Loading branch information
asnare committed Jul 12, 2024
commit 007029bf69310e7d5044bdf22d9c39936e0bd02c
11 changes: 11 additions & 0 deletions tests/unit/test_paths.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,17 @@ def test_with_suffix() -> None:
_ = WorkspacePath(ws, "/").with_suffix(".txt")


def test_as_uri() -> None:
"""Verify that the URI that corresponds to a path can be generated."""
ws = create_autospec(WorkspaceClient)
ws.config.host = "https://example.com/instance"

ws_path = "/tmp/file with spaces.md"
expected_url = "https://example.com/instance#workspace/tmp/file%20with%20spaces.md"

assert WorkspacePath(ws, ws_path).as_uri() == expected_url


@pytest.mark.parametrize(
("path", "parent"),
[
Expand Down