-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
87 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package helpers | ||
|
||
import ( | ||
"os" | ||
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func TempDirWithFiles(t *testing.T, files []string) (string, []string) { | ||
dirPath := t.TempDir() | ||
filePaths := make([]string, 0, len(files)) | ||
for _, filename := range files { | ||
fileName, err := os.CreateTemp(dirPath, filename) | ||
assert.Nil(t, err, "failed to create temporary file in temporary dir") | ||
filePaths = append(filePaths, fileName.Name()) | ||
} | ||
|
||
assert.Len(t, filePaths, len(files), "Expected file paths recorded to match length of requested files") | ||
return dirPath, filePaths | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package integration_test | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/hbomb79/Thea/tests/helpers" | ||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
// TestIngestion_FailsToMetadataScrape ensures that files | ||
// which are not valid media files correctly reports failure. Retrying | ||
// these ingestions should see the same error return. | ||
func TestIngestion_FailsToMetadataScrape(t *testing.T) { | ||
tempDir, _ := helpers.TempDirWithFiles(t, []string{"thisisnotavalidfile.mp4"}) | ||
srvReq := helpers.NewTheaContainerRequest().WithDatabaseName(t.Name()).WithIngestDirectory(tempDir) | ||
srv := helpers.RequireThea(t, srvReq) | ||
|
||
// Connect to the websocket | ||
ws := srv.ConnectToActivitySocket(t) | ||
assert.NotNil(t, ws, "ahh") | ||
} |