Esempio n. 1
0
 def test_publish_agent_positive(self, is_readme_present_mock,
                                 request_api_mock, *mocks):
     """Test for publish_agent positive result."""
     description = "Some description."
     version = "0.1.0"
     context_mock = ContextMock(description=description, version=version)
     publish_agent(context_mock)
     request_api_mock.assert_called_once_with(
         "POST",
         "/agents/create",
         data={
             "name": "agent-name",
             "description": description,
             "version": version,
             "connections": [],
             "contracts": [],
             "protocols": [],
             "skills": [],
         },
         is_auth=True,
         files={
             "file": mock.ANY,
             "readme": mock.ANY
         },
     )
Esempio n. 2
0
 def test_publish_agent_fails(self, *mocks):
     """Test for publish_agent positive result."""
     description = "Some description."
     version = "0.1.0"
     context_mock = ContextMock(description=description, version=version)
     context_mock.cwd = "."
     publish_agent(context_mock)
Esempio n. 3
0
def publish(ctx: Context, registry):
    """Publish Agent to Registry."""
    try_to_load_agent_config(ctx)
    if not registry:
        # TODO: check agent dependencies are available in local packages dir.
        _save_agent_locally(ctx)
    else:
        publish_agent(ctx)
Esempio n. 4
0
def publish(click_context, local):
    """Publish Agent to Registry."""
    ctx = cast(Context, click_context.obj)
    _validate_pkp(ctx.agent_config.private_key_paths)
    if local:
        _save_agent_locally(ctx)
    else:
        publish_agent(ctx)
Esempio n. 5
0
def publish(click_context, local, remote):  # pylint: disable=unused-argument
    """Publish the agent to the registry."""
    ctx = cast(Context, click_context.obj)
    _validate_pkp(ctx.agent_config.private_key_paths)
    _validate_config(ctx)
    if remote:
        publish_agent(ctx)
    else:
        _save_agent_locally(ctx, is_mixed=not local and not remote)