rc/webgui: skip AddPlugin and RemovePlugin tests if download fails

This commit is contained in:
Nick Craig-Wood 2020-08-31 12:38:46 +01:00
parent 9c01ac9894
commit cc0421cb9e

View File

@ -5,10 +5,12 @@ import (
"io/ioutil"
"os"
"path/filepath"
"strings"
"testing"
"github.com/rclone/rclone/fs/rc"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
const testPluginName = "rclone-test-plugin"
@ -39,7 +41,10 @@ func addPlugin(t *testing.T) {
"url": testPluginURL,
}
out, err := addPlugin.Fn(context.Background(), in)
assert.Nil(t, err)
if err != nil && strings.Contains(err.Error(), "bad HTTP status") {
t.Skipf("skipping test as plugin download failed: %v", err)
}
require.Nil(t, err)
assert.Nil(t, out)
}