File: test_connection.py

package info (click to toggle)
python-boto 2.49.0-4.1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 9,888 kB
  • sloc: python: 86,396; makefile: 112
file content (38 lines) | stat: -rw-r--r-- 1,495 bytes parent folder | download | duplicates (13)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
from tests.unit import unittest

from boto.ses.connection import SESConnection
from boto.ses import exceptions


class SESConnectionTest(unittest.TestCase):
    ses = True

    def setUp(self):
        self.ses = SESConnection()

    def test_get_dkim_attributes(self):
        response = self.ses.get_identity_dkim_attributes(['example.com'])
        # Verify we get the structure we expect, we don't care about the
        # values.
        self.assertTrue('GetIdentityDkimAttributesResponse' in response)
        self.assertTrue('GetIdentityDkimAttributesResult' in
                        response['GetIdentityDkimAttributesResponse'])
        self.assertTrue(
            'DkimAttributes' in response['GetIdentityDkimAttributesResponse']
                                        ['GetIdentityDkimAttributesResult'])

    def test_set_identity_dkim_enabled(self):
        # This api call should fail because have not verified the domain,
        # so we can test that it at least fails we we expect.
        with self.assertRaises(exceptions.SESIdentityNotVerifiedError):
            self.ses.set_identity_dkim_enabled('example.com', True)

    def test_verify_domain_dkim(self):
        # This api call should fail because have not confirmed the domain,
        # so we can test that it at least fails we we expect.
        with self.assertRaises(exceptions.SESDomainNotConfirmedError):
            self.ses.verify_domain_dkim('example.com')


if __name__ == '__main__':
    unittest.main()