MCPcopy Index your code
hub / github.com/rclone/rclone / testEncryptSegment

Function testEncryptSegment

backend/crypt/cipher_test.go:189–205  ·  view source on GitHub ↗
(t *testing.T, encoding string, testCases []EncodingTestCase, caseInsensitive bool)

Source from the content-addressed store, hash-verified

187}
188
189func testEncryptSegment(t *testing.T, encoding string, testCases []EncodingTestCase, caseInsensitive bool) {
190 enc, _ := NewNameEncoding(encoding)
191 c, _ := newCipher(NameEncryptionStandard, "", "", true, enc)
192 for _, test := range testCases {
193 actual := c.encryptSegment(test.in)
194 assert.Equal(t, test.expected, actual, fmt.Sprintf("Testing %q", test.in))
195 recovered, err := c.decryptSegment(test.expected)
196 assert.NoError(t, err, fmt.Sprintf("Testing reverse %q", test.expected))
197 assert.Equal(t, test.in, recovered, fmt.Sprintf("Testing reverse %q", test.expected))
198 if caseInsensitive {
199 in := strings.ToUpper(test.expected)
200 recovered, err = c.decryptSegment(in)
201 assert.NoError(t, err, fmt.Sprintf("Testing reverse %q", in))
202 assert.Equal(t, test.in, recovered, fmt.Sprintf("Testing reverse %q", in))
203 }
204 }
205}
206
207func TestEncryptSegmentBase32(t *testing.T) {
208 testEncryptSegment(t, "base32", []EncodingTestCase{

Callers 3

TestEncryptSegmentBase32Function · 0.85
TestEncryptSegmentBase64Function · 0.85

Calls 5

NewNameEncodingFunction · 0.85
newCipherFunction · 0.85
encryptSegmentMethod · 0.80
decryptSegmentMethod · 0.80
EqualMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…