(t *testing.T)
| 3839 | } |
| 3840 | |
| 3841 | func TestCcCheckEncryption(t *testing.T) { |
| 3842 | if testing.Short() { |
| 3843 | t.Skip("skipping on short testing - generating encryption tokens is slow") |
| 3844 | } |
| 3845 | |
| 3846 | w, fcfg := newDefaultCfgWrapper(t) |
| 3847 | m := setupModel(t, w) |
| 3848 | m.cancel() |
| 3849 | defer cleanupModel(m) |
| 3850 | |
| 3851 | pw := "foo" |
| 3852 | token := protocol.PasswordToken(m.keyGen, fcfg.ID, pw) |
| 3853 | m.folderEncryptionPasswordTokens[fcfg.ID] = token |
| 3854 | |
| 3855 | testCases := []struct { |
| 3856 | tokenRemote, tokenLocal []byte |
| 3857 | isEncryptedRemote, isEncryptedLocal bool |
| 3858 | expectedErr error |
| 3859 | }{ |
| 3860 | { |
| 3861 | tokenRemote: token, |
| 3862 | tokenLocal: token, |
| 3863 | expectedErr: errEncryptionInvConfigRemote, |
| 3864 | }, |
| 3865 | { |
| 3866 | isEncryptedRemote: true, |
| 3867 | isEncryptedLocal: true, |
| 3868 | expectedErr: errEncryptionInvConfigLocal, |
| 3869 | }, |
| 3870 | { |
| 3871 | tokenRemote: token, |
| 3872 | tokenLocal: nil, |
| 3873 | isEncryptedRemote: false, |
| 3874 | isEncryptedLocal: false, |
| 3875 | expectedErr: errEncryptionNotEncryptedLocal, |
| 3876 | }, |
| 3877 | { |
| 3878 | tokenRemote: token, |
| 3879 | tokenLocal: nil, |
| 3880 | isEncryptedRemote: true, |
| 3881 | isEncryptedLocal: false, |
| 3882 | expectedErr: nil, |
| 3883 | }, |
| 3884 | { |
| 3885 | tokenRemote: token, |
| 3886 | tokenLocal: nil, |
| 3887 | isEncryptedRemote: false, |
| 3888 | isEncryptedLocal: true, |
| 3889 | expectedErr: nil, |
| 3890 | }, |
| 3891 | { |
| 3892 | tokenRemote: nil, |
| 3893 | tokenLocal: token, |
| 3894 | isEncryptedRemote: true, |
| 3895 | isEncryptedLocal: false, |
| 3896 | expectedErr: nil, |
| 3897 | }, |
| 3898 | { |
nothing calls this directly
no test coverage detected