-
-
Notifications
You must be signed in to change notification settings - Fork 61
Expand file tree
/
Copy pathupdate_test.go
More file actions
26 lines (21 loc) · 792 Bytes
/
update_test.go
File metadata and controls
26 lines (21 loc) · 792 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
//go:build !no_self_update
package main
import (
"testing"
"github.com/creativeprojects/clog"
"github.com/creativeprojects/go-selfupdate"
"github.com/creativeprojects/resticprofile/term"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func TestUpdate(t *testing.T) {
if testing.Short() {
t.Skip("don't run update in short mode")
}
// can't run in Parallel because it changes the default logger
clog.SetTestLog(t)
defer clog.CloseTestLog()
err := confirmAndSelfUpdate(term.NewTerminal(), true, true, "0.0.1", false)
require.ErrorIsf(t, err, selfupdate.ErrExecutableNotFoundInArchive, "error returned isn't wrapping %q but is instead: %q", selfupdate.ErrExecutableNotFoundInArchive, err)
assert.Contains(t, err.Error(), "resticprofile.test")
}