-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert "feat(GODT-1224): Add more test case."
This reverts commit 84d8336. This reverts commit 8983745. This reverts commit d4a5c59. Which are no more needed since handled directly on gopenpgp level by this commit ProtonMail/gopenpgp@b189309
- Loading branch information
1 parent
933cd67
commit 77833c9
Showing
2 changed files
with
10 additions
and
146 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -290,7 +290,7 @@ func TestSendDraftReq_AddPackage(t *testing.T) { | |
EncryptionScheme: proton.ClearScheme, | ||
MIMEType: rfc822.TextPlain, | ||
}}, | ||
wantErr: true, | ||
wantErr: false, | ||
}, | ||
{ | ||
name: "clear plain text with bad scheme (error)", | ||
|
@@ -380,74 +380,3 @@ func TestSendDraftReq_AddPackage(t *testing.T) { | |
}) | ||
} | ||
} | ||
|
||
func TestSendDraftReq_AddClearPackage(t *testing.T) { | ||
key, err := crypto.GenerateKey("name", "email", "rsa", 2048) | ||
require.NoError(t, err) | ||
|
||
kr, err := crypto.NewKeyRing(key) | ||
require.NoError(t, err) | ||
|
||
tests := []struct { | ||
name string | ||
body string | ||
prefs map[string]proton.SendPreferences | ||
attKeys map[string]*crypto.SessionKey | ||
wantErr bool | ||
}{ | ||
{ | ||
name: "clear plain text with signature", | ||
body: "this is a text/plain body", | ||
prefs: map[string]proton.SendPreferences{"[email protected]": { | ||
Encrypt: false, | ||
SignatureType: proton.DetachedSignature, | ||
EncryptionScheme: proton.ClearScheme, | ||
MIMEType: rfc822.TextPlain, | ||
}}, | ||
wantErr: false, | ||
}, | ||
{ | ||
name: "clear plain text with bad scheme (error)", | ||
body: "this is a text/plain body", | ||
prefs: map[string]proton.SendPreferences{"[email protected]": { | ||
Encrypt: false, | ||
SignatureType: proton.DetachedSignature, | ||
EncryptionScheme: proton.PGPInlineScheme, | ||
MIMEType: rfc822.TextPlain, | ||
}}, | ||
wantErr: true, | ||
}, | ||
{ | ||
name: "clear rich text with signature (error)", | ||
body: "this is a text/html body", | ||
prefs: map[string]proton.SendPreferences{"[email protected]": { | ||
Encrypt: false, | ||
SignatureType: proton.DetachedSignature, | ||
EncryptionScheme: proton.ClearScheme, | ||
MIMEType: rfc822.TextHTML, | ||
}}, | ||
wantErr: true, | ||
}, | ||
{ | ||
name: "clear plain text with signature", | ||
body: "this is a text/plain body", | ||
prefs: map[string]proton.SendPreferences{"[email protected]": { | ||
Encrypt: true, | ||
SignatureType: proton.DetachedSignature, | ||
EncryptionScheme: proton.ClearScheme, | ||
MIMEType: rfc822.TextPlain, | ||
}}, | ||
wantErr: true, | ||
}, | ||
} | ||
|
||
for _, tt := range tests { | ||
t.Run(tt.name, func(t *testing.T) { | ||
var req proton.SendDraftReq | ||
|
||
if err := req.AddClearSignedPackage(kr, tt.body, tt.prefs, tt.attKeys); (err != nil) != tt.wantErr { | ||
t.Errorf("SendDraftReq.AddPackage() error = %v, wantErr %v", err, tt.wantErr) | ||
} | ||
}) | ||
} | ||
} |