mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-08-16 06:27:58 +00:00
chore(rename): move llama_stack.distribution to llama_stack.core (#2975)
We would like to rename the term `template` to `distribution`. To prepare for that, this is a precursor. cc @leseb
This commit is contained in:
parent
f3d5459647
commit
2665f00102
211 changed files with 351 additions and 348 deletions
|
@ -12,9 +12,9 @@ from pydantic import TypeAdapter, ValidationError
|
|||
|
||||
from llama_stack.apis.datatypes import Api
|
||||
from llama_stack.apis.models import ModelType
|
||||
from llama_stack.distribution.access_control.access_control import AccessDeniedError, is_action_allowed
|
||||
from llama_stack.distribution.datatypes import AccessRule, ModelWithOwner, User
|
||||
from llama_stack.distribution.routing_tables.models import ModelsRoutingTable
|
||||
from llama_stack.core.access_control.access_control import AccessDeniedError, is_action_allowed
|
||||
from llama_stack.core.datatypes import AccessRule, ModelWithOwner, User
|
||||
from llama_stack.core.routing_tables.models import ModelsRoutingTable
|
||||
|
||||
|
||||
class AsyncMock(MagicMock):
|
||||
|
@ -40,7 +40,7 @@ async def test_setup(cached_disk_dist_registry):
|
|||
yield cached_disk_dist_registry, routing_table
|
||||
|
||||
|
||||
@patch("llama_stack.distribution.routing_tables.common.get_authenticated_user")
|
||||
@patch("llama_stack.core.routing_tables.common.get_authenticated_user")
|
||||
async def test_access_control_with_cache(mock_get_authenticated_user, test_setup):
|
||||
registry, routing_table = test_setup
|
||||
model_public = ModelWithOwner(
|
||||
|
@ -104,7 +104,7 @@ async def test_access_control_with_cache(mock_get_authenticated_user, test_setup
|
|||
await routing_table.get_model("model-admin")
|
||||
|
||||
|
||||
@patch("llama_stack.distribution.routing_tables.common.get_authenticated_user")
|
||||
@patch("llama_stack.core.routing_tables.common.get_authenticated_user")
|
||||
async def test_access_control_and_updates(mock_get_authenticated_user, test_setup):
|
||||
registry, routing_table = test_setup
|
||||
model_public = ModelWithOwner(
|
||||
|
@ -142,7 +142,7 @@ async def test_access_control_and_updates(mock_get_authenticated_user, test_setu
|
|||
assert model.identifier == "model-updates"
|
||||
|
||||
|
||||
@patch("llama_stack.distribution.routing_tables.common.get_authenticated_user")
|
||||
@patch("llama_stack.core.routing_tables.common.get_authenticated_user")
|
||||
async def test_access_control_empty_attributes(mock_get_authenticated_user, test_setup):
|
||||
registry, routing_table = test_setup
|
||||
model = ModelWithOwner(
|
||||
|
@ -166,7 +166,7 @@ async def test_access_control_empty_attributes(mock_get_authenticated_user, test
|
|||
assert "model-empty-attrs" in model_ids
|
||||
|
||||
|
||||
@patch("llama_stack.distribution.routing_tables.common.get_authenticated_user")
|
||||
@patch("llama_stack.core.routing_tables.common.get_authenticated_user")
|
||||
async def test_no_user_attributes(mock_get_authenticated_user, test_setup):
|
||||
registry, routing_table = test_setup
|
||||
model_public = ModelWithOwner(
|
||||
|
@ -196,7 +196,7 @@ async def test_no_user_attributes(mock_get_authenticated_user, test_setup):
|
|||
assert all_models.data[0].identifier == "model-public-2"
|
||||
|
||||
|
||||
@patch("llama_stack.distribution.routing_tables.common.get_authenticated_user")
|
||||
@patch("llama_stack.core.routing_tables.common.get_authenticated_user")
|
||||
async def test_automatic_access_attributes(mock_get_authenticated_user, test_setup):
|
||||
"""Test that newly created resources inherit access attributes from their creator."""
|
||||
registry, routing_table = test_setup
|
||||
|
@ -275,7 +275,7 @@ async def test_setup_with_access_policy(cached_disk_dist_registry):
|
|||
yield routing_table
|
||||
|
||||
|
||||
@patch("llama_stack.distribution.routing_tables.common.get_authenticated_user")
|
||||
@patch("llama_stack.core.routing_tables.common.get_authenticated_user")
|
||||
async def test_access_policy(mock_get_authenticated_user, test_setup_with_access_policy):
|
||||
routing_table = test_setup_with_access_policy
|
||||
mock_get_authenticated_user.return_value = User(
|
||||
|
@ -561,6 +561,6 @@ def test_invalid_condition():
|
|||
],
|
||||
)
|
||||
def test_condition_reprs(condition):
|
||||
from llama_stack.distribution.access_control.conditions import parse_condition
|
||||
from llama_stack.core.access_control.conditions import parse_condition
|
||||
|
||||
assert condition == str(parse_condition(condition))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue