From e66f795783e89b7f60ed5d8f1118bf1b111faa34 Mon Sep 17 00:00:00 2001 From: Theresa Gresch Date: Wed, 17 Jul 2019 11:59:21 +0200 Subject: [PATCH] Add test for loadLabels function --- internal/photoprism/tensorflow_test.go | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/internal/photoprism/tensorflow_test.go b/internal/photoprism/tensorflow_test.go index f87add666..ed871f4c4 100644 --- a/internal/photoprism/tensorflow_test.go +++ b/internal/photoprism/tensorflow_test.go @@ -144,6 +144,27 @@ func TestTensorFlow_Labels(t *testing.T) { }) } +func TestTensorFlow_LoadLabels(t *testing.T) { + t.Run("labels.txt exists", func(t *testing.T) { + conf := config.NewTestConfig() + + tensorFlow := NewTensorFlow(conf) + path := conf.TensorFlowModelPath() + + result := tensorFlow.loadLabels(path) + assert.Nil(t, result) + }) + t.Run("label.txt does not exist", func(t *testing.T) { + conf := config.NewTestErrorConfig() + + tensorFlow := NewTensorFlow(conf) + path := conf.TensorFlowModelPath() + + result := tensorFlow.loadLabels(path) + assert.Contains(t, result.Error(), "no such file or directory") + }) +} + func TestTensorFlow_LoadModel(t *testing.T) { t.Run("model path exists", func(t *testing.T) { conf := config.NewTestConfig()