feat: upload audio, get a private Swedish transcript, discuss it (#33, ADR-033) #39
@@ -0,0 +1,32 @@
|
||||
package audio_test
|
||||
|
||||
import (
|
||||
"context"
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"git.d-ma.be/mathias/tapir/internal/adapters/audio"
|
||||
"git.d-ma.be/mathias/tapir/internal/uploads"
|
||||
)
|
||||
|
||||
// TestFFprobeLive_HostilePlaylistsAreRefusedAndRealAudioIsNot runs the REAL ffprobe
|
||||
// (opt-in: TAPIR_LIVE_FFPROBE) on crafted concat/HLS files and on a real m4a.
|
||||
func TestFFprobeLive_HostilePlaylistsAreRefusedAndRealAudioIsNot(t *testing.T) {
|
||||
bin := os.Getenv("TAPIR_LIVE_FFPROBE")
|
||||
if bin == "" {
|
||||
t.Skip("set TAPIR_LIVE_FFPROBE (and TAPIR_LIVE_HOSTILE_DIR, TAPIR_LIVE_M4A) to run against the real ffprobe")
|
||||
}
|
||||
p := &audio.FFprobe{Bin: bin}
|
||||
for _, name := range []string{"up-concat", "up-hls"} {
|
||||
_, err := p.Probe(context.Background(), os.Getenv("TAPIR_LIVE_HOSTILE_DIR")+"/"+name)
|
||||
assert.ErrorIs(t, err, uploads.ErrUnreadable, name)
|
||||
}
|
||||
got, err := p.Probe(context.Background(), os.Getenv("TAPIR_LIVE_M4A"))
|
||||
require.NoError(t, err)
|
||||
assert.True(t, got.HasAudio)
|
||||
assert.False(t, got.HasVideo)
|
||||
assert.InDelta(t, 82.5, got.Duration.Seconds(), 1)
|
||||
}
|
||||
Reference in New Issue
Block a user