@@ -626,3 +626,43 @@ func TestAppBrickInstanceModelsDetails(t *testing.T) {
626626 })
627627 }
628628}
629+
630+ func TestAppBrickInstanceDetails (t * testing.T ) {
631+ bricksIndex , err := bricksindex .GenerateBricksIndexFromFile (paths .New ("testdata" ))
632+ require .Nil (t , err )
633+ brickService := NewService (nil , bricksIndex , nil )
634+ tempDirectory := t .TempDir ()
635+
636+ app := app.ArduinoApp {
637+ Name : "TestApp" ,
638+ Descriptor : app.AppDescriptor {
639+ Bricks : []app.Brick {
640+ {
641+ ID : "arduino:image_classification" ,
642+ },
643+ },
644+ },
645+ FullPath : paths .New (tempDirectory ),
646+ }
647+ configVariables , _ := brickService .AppBrickInstanceDetails (& app , bricksIndex .Bricks [2 ].ID )
648+
649+ expectedConfigVariables := BrickInstance {
650+ Name : "Image Classification" ,
651+ ID : "arduino:image_classification" ,
652+ Author : "Arduino" ,
653+ Category : "video" ,
654+ Status : "installed" ,
655+ Variables : map [string ]string {
656+ "CUSTOM_MODEL_PATH" : "/home/arduino/.arduino-bricks/ei-models" ,
657+ "EI_CLASSIFICATION_MODEL" : "/models/ootb/ei/mobilenet-v2-224px.eim" ,
658+ },
659+ ConfigVariables : []BrickConfigVariable {
660+ {Name : "CUSTOM_MODEL_PATH" , Value : "/home/arduino/.arduino-bricks/ei-models" , Description : "path to the custom model directory" , Required : false },
661+ {Name : "EI_CLASSIFICATION_MODEL" , Value : "/models/ootb/ei/mobilenet-v2-224px.eim" , Description : "path to the model file" , Required : false },
662+ },
663+ RequireModel : true ,
664+ ModelID : "mobilenet-image-classification" ,
665+ }
666+
667+ require .Equal (t , expectedConfigVariables , configVariables )
668+ }
0 commit comments