refact: repo id are not based on path but on id

This commit is contained in:
2025-01-05 15:13:38 +01:00
parent ae61fd3c12
commit 8a43a93cda
2 changed files with 53 additions and 60 deletions

View File

@@ -45,50 +45,50 @@ def test_init(location):
@pytest.fixture
def repository(location) -> FSRepository:
return FSRepository("example", "example", location)
return FSRepository("repo_id", "example", location)
def test_list_schemas(repository):
assert repository.schemas() == ["example-schema"]
assert repository.schemas() == ["repo_id-schema"]
def test_describe_schema(location, repository):
schema = repository.schema("example-schema")
schema = repository.schema("repo_id-schema")
assert schema.name == "schema"
assert schema.id == "example-schema"
assert schema.repo_id == str(location)
assert schema.id == "repo_id-schema"
assert schema.repo_id == "repo_id"
assert schema.value == str(location / "schema")
assert schema.tables == [
"example-schema-username",
"example-schema-recovery",
"example-schema-salary",
"repo_id-schema-username",
"repo_id-schema-recovery",
"repo_id-schema-salary",
]
def test_list_tables_schema(repository):
assert repository.schema("example-schema").tables == [
"example-schema-username",
"example-schema-recovery",
"example-schema-salary",
assert repository.schema("repo_id-schema").tables == [
"repo_id-schema-username",
"repo_id-schema-recovery",
"repo_id-schema-salary",
]
assert repository.tables("example-schema") == [
"example-schema-username",
"example-schema-recovery",
"example-schema-salary",
assert repository.tables("repo_id-schema") == [
"repo_id-schema-username",
"repo_id-schema-recovery",
"repo_id-schema-salary",
]
assert repository.tables() == [
"example-schema-username",
"example-schema-recovery",
"example-schema-salary",
"repo_id-schema-username",
"repo_id-schema-recovery",
"repo_id-schema-salary",
]
def test_describe_table(location, repository):
table = repository.table("example-schema-username")
table = repository.table("repo_id-schema-username")
assert table.id == "example-schema-username"
assert table.repo_id == str(location)
assert table.schema_id == str(location / "schema")
assert table.id == "repo_id-schema-username"
assert table.repo_id == "repo_id"
assert table.schema_id == "repo_id-schema"
assert table.name == "username"
assert table.value == str(location / "schema" / "username")
assert table.partitions == ["username.csv"]
@@ -96,11 +96,11 @@ def test_describe_table(location, repository):
def test_describe_table_with_partitions(location, repository):
table = repository.table("example-schema-recovery")
table = repository.table("repo_id-schema-recovery")
assert table.id == "example-schema-recovery"
assert table.repo_id == str(location)
assert table.schema_id == str(location / "schema")
assert table.id == "repo_id-schema-recovery"
assert table.repo_id == "repo_id"
assert table.schema_id == "repo_id-schema"
assert table.name == "recovery"
assert table.value == str(location / "schema" / "recovery")
assert table.partitions == [