| import pytest |
|
|
| from src.config import user_bucket_source |
| from src.jobs import normalize_target_space |
|
|
|
|
| def test_normalize_target_space_with_slug(): |
| assert normalize_target_space(username="alice", target_slug="my-space", run_id="run-123") == "alice/my-space" |
|
|
|
|
| def test_normalize_target_space_rejects_other_namespace(): |
| with pytest.raises(ValueError): |
| normalize_target_space(username="alice", target_slug="bob/my-space", run_id="run-123") |
|
|
|
|
| def test_normalize_target_space_accepts_own_namespace(): |
| assert normalize_target_space(username="alice", target_slug="alice/my-space", run_id="run-123") == "alice/my-space" |
|
|
|
|
| def test_user_bucket_source_uses_signed_in_namespace(): |
| assert user_bucket_source(username="alice", bucket_name="space-factory-runs") == "alice/space-factory-runs" |
|
|
|
|
| def test_user_bucket_source_rejects_owner_name_bucket(): |
| with pytest.raises(ValueError): |
| user_bucket_source(username="alice", bucket_name="bob/space-factory-runs") |
|
|