@@ -526,3 +526,179 @@ func TestDescribeAgentEditorConsumedMCPService_Mock(t *testing.T) {
526526 assertContainsStr (t , out , "create consumed mcp service" )
527527 assertContainsStr (t , out , "ProtocolVersion" )
528528}
529+
530+ // ---------------------------------------------------------------------------
531+ // DESCRIBE — Not Found
532+ // ---------------------------------------------------------------------------
533+
534+ func TestDescribeAgentEditorModel_Mock_NotFound (t * testing.T ) {
535+ mod := mkModule ("M" )
536+ h := mkHierarchy (mod )
537+
538+ mb := & mock.MockBackend {
539+ IsConnectedFunc : func () bool { return true },
540+ ListAgentEditorModelsFunc : func () ([]* agenteditor.Model , error ) { return nil , nil },
541+ }
542+ ctx , _ := newMockCtx (t , withBackend (mb ), withHierarchy (h ))
543+ assertError (t , describeAgentEditorModel (ctx , ast.QualifiedName {Module : "M" , Name : "NonExistent" }))
544+ }
545+
546+ func TestDescribeAgentEditorAgent_Mock_NotFound (t * testing.T ) {
547+ mod := mkModule ("M" )
548+ h := mkHierarchy (mod )
549+
550+ mb := & mock.MockBackend {
551+ IsConnectedFunc : func () bool { return true },
552+ ListAgentEditorAgentsFunc : func () ([]* agenteditor.Agent , error ) { return nil , nil },
553+ }
554+ ctx , _ := newMockCtx (t , withBackend (mb ), withHierarchy (h ))
555+ assertError (t , describeAgentEditorAgent (ctx , ast.QualifiedName {Module : "M" , Name : "NonExistent" }))
556+ }
557+
558+ func TestDescribeAgentEditorKnowledgeBase_Mock_NotFound (t * testing.T ) {
559+ mod := mkModule ("M" )
560+ h := mkHierarchy (mod )
561+
562+ mb := & mock.MockBackend {
563+ IsConnectedFunc : func () bool { return true },
564+ ListAgentEditorKnowledgeBasesFunc : func () ([]* agenteditor.KnowledgeBase , error ) { return nil , nil },
565+ }
566+ ctx , _ := newMockCtx (t , withBackend (mb ), withHierarchy (h ))
567+ assertError (t , describeAgentEditorKnowledgeBase (ctx , ast.QualifiedName {Module : "M" , Name : "NonExistent" }))
568+ }
569+
570+ func TestDescribeAgentEditorConsumedMCPService_Mock_NotFound (t * testing.T ) {
571+ mod := mkModule ("M" )
572+ h := mkHierarchy (mod )
573+
574+ mb := & mock.MockBackend {
575+ IsConnectedFunc : func () bool { return true },
576+ ListAgentEditorConsumedMCPServicesFunc : func () ([]* agenteditor.ConsumedMCPService , error ) { return nil , nil },
577+ }
578+ ctx , _ := newMockCtx (t , withBackend (mb ), withHierarchy (h ))
579+ assertError (t , describeAgentEditorConsumedMCPService (ctx , ast.QualifiedName {Module : "M" , Name : "NonExistent" }))
580+ }
581+
582+ // ---------------------------------------------------------------------------
583+ // DROP — Not Found
584+ // ---------------------------------------------------------------------------
585+
586+ func TestDropAgentEditorModel_Mock_NotFound (t * testing.T ) {
587+ mod := mkModule ("M" )
588+ h := mkHierarchy (mod )
589+
590+ mb := & mock.MockBackend {
591+ IsConnectedFunc : func () bool { return true },
592+ ListAgentEditorModelsFunc : func () ([]* agenteditor.Model , error ) { return nil , nil },
593+ }
594+ ctx , _ := newMockCtx (t , withBackend (mb ), withHierarchy (h ))
595+ assertError (t , execDropAgentEditorModel (ctx , & ast.DropModelStmt {
596+ Name : ast.QualifiedName {Module : "M" , Name : "NonExistent" },
597+ }))
598+ }
599+
600+ func TestDropConsumedMCPService_Mock_NotFound (t * testing.T ) {
601+ mod := mkModule ("M" )
602+ h := mkHierarchy (mod )
603+
604+ mb := & mock.MockBackend {
605+ IsConnectedFunc : func () bool { return true },
606+ ListAgentEditorConsumedMCPServicesFunc : func () ([]* agenteditor.ConsumedMCPService , error ) { return nil , nil },
607+ }
608+ ctx , _ := newMockCtx (t , withBackend (mb ), withHierarchy (h ))
609+ assertError (t , execDropConsumedMCPService (ctx , & ast.DropConsumedMCPServiceStmt {
610+ Name : ast.QualifiedName {Module : "M" , Name : "NonExistent" },
611+ }))
612+ }
613+
614+ func TestDropKnowledgeBase_Mock_NotFound (t * testing.T ) {
615+ mod := mkModule ("M" )
616+ h := mkHierarchy (mod )
617+
618+ mb := & mock.MockBackend {
619+ IsConnectedFunc : func () bool { return true },
620+ ListAgentEditorKnowledgeBasesFunc : func () ([]* agenteditor.KnowledgeBase , error ) { return nil , nil },
621+ }
622+ ctx , _ := newMockCtx (t , withBackend (mb ), withHierarchy (h ))
623+ assertError (t , execDropKnowledgeBase (ctx , & ast.DropKnowledgeBaseStmt {
624+ Name : ast.QualifiedName {Module : "M" , Name : "NonExistent" },
625+ }))
626+ }
627+
628+ func TestDropAgent_Mock_NotFound (t * testing.T ) {
629+ mod := mkModule ("M" )
630+ h := mkHierarchy (mod )
631+
632+ mb := & mock.MockBackend {
633+ IsConnectedFunc : func () bool { return true },
634+ ListAgentEditorAgentsFunc : func () ([]* agenteditor.Agent , error ) { return nil , nil },
635+ }
636+ ctx , _ := newMockCtx (t , withBackend (mb ), withHierarchy (h ))
637+ assertError (t , execDropAgent (ctx , & ast.DropAgentStmt {
638+ Name : ast.QualifiedName {Module : "M" , Name : "NonExistent" },
639+ }))
640+ }
641+
642+ // ---------------------------------------------------------------------------
643+ // LIST — Filter by Module
644+ // ---------------------------------------------------------------------------
645+
646+ func TestShowAgentEditorModels_Mock_FilterByModule (t * testing.T ) {
647+ mod1 := mkModule ("A" )
648+ mod2 := mkModule ("B" )
649+ m1 := & agenteditor.Model {
650+ BaseElement : model.BaseElement {ID : nextID ("aem" )},
651+ ContainerID : mod1 .ID ,
652+ Name : "M1" ,
653+ }
654+ m2 := & agenteditor.Model {
655+ BaseElement : model.BaseElement {ID : nextID ("aem" )},
656+ ContainerID : mod2 .ID ,
657+ Name : "M2" ,
658+ }
659+
660+ h := mkHierarchy (mod1 , mod2 )
661+ withContainer (h , m1 .ContainerID , mod1 .ID )
662+ withContainer (h , m2 .ContainerID , mod2 .ID )
663+
664+ mb := & mock.MockBackend {
665+ IsConnectedFunc : func () bool { return true },
666+ ListAgentEditorModelsFunc : func () ([]* agenteditor.Model , error ) { return []* agenteditor.Model {m1 , m2 }, nil },
667+ }
668+ ctx , buf := newMockCtx (t , withBackend (mb ), withHierarchy (h ))
669+ assertNoError (t , listAgentEditorModels (ctx , "B" ))
670+
671+ out := buf .String ()
672+ assertNotContainsStr (t , out , "A.M1" )
673+ assertContainsStr (t , out , "B.M2" )
674+ }
675+
676+ func TestShowAgentEditorAgents_Mock_FilterByModule (t * testing.T ) {
677+ mod1 := mkModule ("A" )
678+ mod2 := mkModule ("B" )
679+ a1 := & agenteditor.Agent {
680+ BaseElement : model.BaseElement {ID : nextID ("aea" )},
681+ ContainerID : mod1 .ID ,
682+ Name : "Agent1" ,
683+ }
684+ a2 := & agenteditor.Agent {
685+ BaseElement : model.BaseElement {ID : nextID ("aea" )},
686+ ContainerID : mod2 .ID ,
687+ Name : "Agent2" ,
688+ }
689+
690+ h := mkHierarchy (mod1 , mod2 )
691+ withContainer (h , a1 .ContainerID , mod1 .ID )
692+ withContainer (h , a2 .ContainerID , mod2 .ID )
693+
694+ mb := & mock.MockBackend {
695+ IsConnectedFunc : func () bool { return true },
696+ ListAgentEditorAgentsFunc : func () ([]* agenteditor.Agent , error ) { return []* agenteditor.Agent {a1 , a2 }, nil },
697+ }
698+ ctx , buf := newMockCtx (t , withBackend (mb ), withHierarchy (h ))
699+ assertNoError (t , listAgentEditorAgents (ctx , "B" ))
700+
701+ out := buf .String ()
702+ assertNotContainsStr (t , out , "A.Agent1" )
703+ assertContainsStr (t , out , "B.Agent2" )
704+ }
0 commit comments