@@ -119,19 +119,6 @@ func TestGetBrickInstanceVariableDetails(t *testing.T) {
119119 expectedConfigVariables []BrickConfigVariable
120120 expectedVariableMap map [string ]string
121121 }{
122- {
123- name : "variable is present in the map" ,
124- brick : & bricksindex.Brick {
125- Variables : []bricksindex.BrickVariable {
126- {Name : "VAR1" , Description : "desc" },
127- },
128- },
129- userVariables : map [string ]string {"VAR1" : "value1" },
130- expectedConfigVariables : []BrickConfigVariable {
131- {Name : "VAR1" , Value : "value1" , Description : "desc" , Required : true },
132- },
133- expectedVariableMap : map [string ]string {"VAR1" : "value1" },
134- },
135122 {
136123 name : "variable not present in the map" ,
137124 brick : & bricksindex.Brick {
@@ -190,3 +177,26 @@ func TestGetBrickInstanceVariableDetails(t *testing.T) {
190177 })
191178 }
192179}
180+
181+ func TestBricksList (t * testing.T ) {
182+ bricksIndex , err := bricksindex .GenerateBricksIndexFromFile (paths .New ("testdata" ))
183+ require .Nil (t , err )
184+
185+ b_db , found := bricksIndex .FindBrickByID ("arduino:dbstorage_sqlstore" )
186+ require .True (t , found )
187+ require .Equal (t , "Database - SQL" , b_db .Name )
188+ require .False (t , b_db .RequireModel )
189+
190+ b_ic , found := bricksIndex .FindBrickByID ("arduino:image_classification" )
191+ require .True (t , found )
192+ require .Equal (t , "Image Classification" , b_ic .Name )
193+ require .Equal (t , "mobilenet-image-classification" , b_ic .ModelName )
194+ require .True (t , b_ic .RequireModel )
195+ require .Len (t , b_ic .Variables , 2 )
196+ require .Equal (t , "CUSTOM_MODEL_PATH" , b_ic .Variables [0 ].Name )
197+ require .Equal (t , "/home/arduino/.arduino-bricks/ei-models" , b_ic .Variables [0 ].DefaultValue )
198+ require .Equal (t , "path to the custom model directory" , b_ic .Variables [0 ].Description )
199+ require .Equal (t , "EI_CLASSIFICATION_MODEL" , b_ic .Variables [1 ].Name )
200+ require .Equal (t , "/models/ootb/ei/mobilenet-v2-224px.eim" , b_ic .Variables [1 ].DefaultValue )
201+ require .Equal (t , "path to the model file" , b_ic .Variables [1 ].Description )
202+ }
0 commit comments