mirror of
https://github.com/rclone/rclone.git
synced 2024-11-27 02:45:16 +01:00
0fa700b3cf
* Removed generated code and code generator * Updated docs on how to write integration tests * Tidied up the actual integration tests
63 lines
1.9 KiB
Go
63 lines
1.9 KiB
Go
// Test Crypt filesystem interface
|
|
package crypt_test
|
|
|
|
import (
|
|
"os"
|
|
"path/filepath"
|
|
"testing"
|
|
|
|
"github.com/ncw/rclone/backend/crypt"
|
|
_ "github.com/ncw/rclone/backend/local"
|
|
"github.com/ncw/rclone/fs/config/obscure"
|
|
"github.com/ncw/rclone/fstest/fstests"
|
|
)
|
|
|
|
// 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"},
|
|
},
|
|
})
|
|
}
|
|
|
|
// 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,
|
|
})
|
|
}
|