2016-07-25 18:18:56 +00:00
|
|
|
// Test Crypt filesystem interface
|
|
|
|
package crypt_test
|
|
|
|
|
|
|
|
import (
|
2018-04-07 17:48:11 +00:00
|
|
|
"os"
|
|
|
|
"path/filepath"
|
2016-07-25 18:18:56 +00:00
|
|
|
"testing"
|
|
|
|
|
2018-01-11 16:05:41 +00:00
|
|
|
"github.com/ncw/rclone/backend/crypt"
|
|
|
|
_ "github.com/ncw/rclone/backend/local"
|
2018-04-07 17:48:11 +00:00
|
|
|
"github.com/ncw/rclone/fs/config/obscure"
|
2016-07-25 18:18:56 +00:00
|
|
|
"github.com/ncw/rclone/fstest/fstests"
|
|
|
|
)
|
|
|
|
|
2018-04-07 17:48:11 +00:00
|
|
|
// TestStandard runs integration tests against the remote
|
|
|
|
func TestStandard(t *testing.T) {
|
|
|
|
tempdir := filepath.Join(os.TempDir(), "rclone-crypt-test-standard")
|
|
|
|
name := "TestCrypt"
|
|
|
|
fstests.Run(t, &fstests.Opt{
|
|
|
|
RemoteName: name + ":",
|
|
|
|
NilObject: (*crypt.Object)(nil),
|
|
|
|
ExtraConfig: []fstests.ExtraConfigItem{
|
|
|
|
{Name: name, Key: "type", Value: "crypt"},
|
|
|
|
{Name: name, Key: "remote", Value: tempdir},
|
|
|
|
{Name: name, Key: "password", Value: obscure.MustObscure("potato")},
|
|
|
|
{Name: name, Key: "filename_encryption", Value: "standard"},
|
|
|
|
},
|
|
|
|
})
|
2016-07-25 18:18:56 +00:00
|
|
|
}
|
|
|
|
|
2018-04-07 17:48:11 +00:00
|
|
|
// TestOff runs integration tests against the remote
|
|
|
|
func TestOff(t *testing.T) {
|
|
|
|
tempdir := filepath.Join(os.TempDir(), "rclone-crypt-test-off")
|
|
|
|
name := "TestCrypt2"
|
|
|
|
fstests.Run(t, &fstests.Opt{
|
|
|
|
RemoteName: name + ":",
|
|
|
|
NilObject: (*crypt.Object)(nil),
|
|
|
|
ExtraConfig: []fstests.ExtraConfigItem{
|
|
|
|
{Name: name, Key: "type", Value: "crypt"},
|
|
|
|
{Name: name, Key: "remote", Value: tempdir},
|
|
|
|
{Name: name, Key: "password", Value: obscure.MustObscure("potato2")},
|
|
|
|
{Name: name, Key: "filename_encryption", Value: "off"},
|
|
|
|
},
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
// TestObfuscate runs integration tests against the remote
|
|
|
|
func TestObfuscate(t *testing.T) {
|
|
|
|
tempdir := filepath.Join(os.TempDir(), "rclone-crypt-test-obfuscate")
|
|
|
|
name := "TestCrypt3"
|
|
|
|
fstests.Run(t, &fstests.Opt{
|
|
|
|
RemoteName: name + ":",
|
|
|
|
NilObject: (*crypt.Object)(nil),
|
|
|
|
ExtraConfig: []fstests.ExtraConfigItem{
|
|
|
|
{Name: name, Key: "type", Value: "crypt"},
|
|
|
|
{Name: name, Key: "remote", Value: tempdir},
|
|
|
|
{Name: name, Key: "password", Value: obscure.MustObscure("potato2")},
|
|
|
|
{Name: name, Key: "filename_encryption", Value: "obfuscate"},
|
|
|
|
},
|
|
|
|
SkipBadWindowsCharacters: true,
|
|
|
|
})
|
|
|
|
}
|