'Email sent from an MUA has DKIM and TLS headers'

def test_smtps_headers(self):

    import smtplib
    import imaplib
    (msg, subject) = new_message(TEST_ADDRESS, 'root@sovereign.local')
    s = smtplib.SMTP_SSL(TEST_SERVER, 465)
    s.login(TEST_ADDRESS, TEST_PASSWORD)
    s.sendmail(TEST_ADDRESS, ['root@sovereign.local'], msg)
    s.quit()
    sleep(1)
    m = imaplib.IMAP4_SSL(TEST_SERVER, 993)
    m.login(TEST_ADDRESS, TEST_PASSWORD)
    m.select()
    (_, res) = m.search(None, '(SUBJECT    "{}")'.format(subject))
    (_, data) = m.fetch(res[0], '(RFC822)')
    self.assertIn('DKIM-Signature:    v=1;    a=rsa-sha256;    c=relaxed/relaxed;    d=sovereign.local;', data[0][1])
    self.assertIn('ECDHE-RSA-AES256-GCM-SHA384    (256/256    bits)', data[0][1])
    m.store(res[0].strip(), '+FLAGS', '\\Deleted')
    m.expunge()
    m.close()
    m.logout()
