test: fix test content types

This commit is contained in:
James Houlahan
2020-08-05 10:57:44 +02:00
parent 64fbd0655f
commit 33d705a39d
2 changed files with 15 additions and 11 deletions

View File

@ -95,11 +95,13 @@ func (b *sendPreferencesBuilder) shouldEncrypt() bool {
return false
}
func (b *sendPreferencesBuilder) withSign(v bool) {
func (b *sendPreferencesBuilder) withSign() {
v := true
b.sign = &v
}
func (b *sendPreferencesBuilder) withSignDefault(v bool) {
func (b *sendPreferencesBuilder) withSignDefault() {
v := true
if b.sign == nil {
b.sign = &v
}
@ -256,7 +258,7 @@ func (b *sendPreferencesBuilder) setInternalPGPSettings(
// We always encrypt and sign internal mail.
b.withEncrypt(true)
b.withSign(true)
b.withSign()
// We use a custom scheme for internal messages.
b.withScheme(pmInternal)
@ -367,7 +369,7 @@ func (b *sendPreferencesBuilder) setExternalPGPSettingsWithWKDKeys(
// We always encrypt and sign external mail if WKD keys are present.
b.withEncrypt(true)
b.withSign(true)
b.withSign()
// If the contact has a specific Scheme preference, we set it (otherwise we
// leave it unset to allow it to be filled in with the default value later).
@ -402,7 +404,7 @@ func (b *sendPreferencesBuilder) setExternalPGPSettingsWithoutWKDKeys(
// Sign must be enabled whenever encrypt is.
if vCardData.Sign || vCardData.Encrypt {
b.withSign(true)
b.withSign()
}
// If the contact has a specific Scheme preference, we set it (otherwise we
@ -468,10 +470,12 @@ func (b *sendPreferencesBuilder) setEncryptionPreferences(mailSettings pmapi.Mai
// mail setting "Sign External messages". Otherwise we keep the defined value
// unless it conflicts with the encrypt flag (we do not allow to send
// encrypted but not signed).
b.withSignDefault(mailSettings.Sign > 0)
if mailSettings.Sign > 0 {
b.withSignDefault()
}
if b.shouldEncrypt() {
b.withSign(true)
b.withSign()
}
// If undefined, default to the user mail setting "Default PGP scheme".