mirror of
https://github.com/wneessen/go-mail.git
synced 2024-11-22 05:40:50 +01:00
feat: improved tests
This commit is contained in:
parent
2c2ee4c1fb
commit
6ea0974156
3 changed files with 27 additions and 0 deletions
|
@ -174,3 +174,8 @@ func (c ContentType) String() string {
|
|||
func (e Encoding) String() string {
|
||||
return string(e)
|
||||
}
|
||||
|
||||
// String is a standard method to convert an MIMEType into a printable format
|
||||
func (e MIMEType) String() string {
|
||||
return string(e)
|
||||
}
|
||||
|
|
|
@ -126,3 +126,24 @@ func TestCharset_String(t *testing.T) {
|
|||
})
|
||||
}
|
||||
}
|
||||
|
||||
// TestContentType_String tests the mime type method of the MIMEType object
|
||||
func TestMimeType_String(t *testing.T) {
|
||||
tests := []struct {
|
||||
mt MIMEType
|
||||
want string
|
||||
}{
|
||||
{MIMEAlternative, "alternative"},
|
||||
{MIMEMixed, "mixed"},
|
||||
{MIMERelated, "related"},
|
||||
{MIMESMime, `signed; protocol="application/pkcs7-signature"; micalg=sha-256`},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.mt.String(), func(t *testing.T) {
|
||||
if tt.mt.String() != tt.want {
|
||||
t.Errorf("wrong string for mime type returned. Expected: %s, got: %s",
|
||||
tt.want, tt.mt.String())
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@ const (
|
|||
keyFilePath = "dummy-child-key.pem"
|
||||
)
|
||||
|
||||
// getDummyCertificate loads a certificate and a private key form local disk for testing purposes
|
||||
func getDummyCertificate() (*tls.Certificate, error) {
|
||||
keyPair, err := tls.LoadX509KeyPair(certFilePath, keyFilePath)
|
||||
if err != nil {
|
||||
|
|
Loading…
Reference in a new issue